installing pyHook without prior download python 2.7 - python

So, I'm trying to make a simple keylogger and I have this next bit of code:
try:
import pyHook, pythoncom
except:
os.system("pip install pypiwin32")
os.system("pip install pyHook")
import pyHook, pythoncom
the installation of pypiwin32 works, and after doing the command
os.system("pip install pypiwin32")
I can use pythoncom.
however, the second command doesn't seem to work.
I want this to work on every computer, hence - without a need to download a whl file. is it possible to install pyHook like that?
thanks.

I mean. Your asking people to help you to essentially steal stuff. But sure I'll help. https://pypi.python.org/pypi/keyboard/
Check this out
I don't think your code would 100% work on an pcs.

Related

Learning Python with Chromebook. Having trouble importing external modules into IDLE

I have had some issues with importing external modules into IDLE on chromebook.
For example I would like to start with termcolor. I was able to download termcolor through the linux shell using the command:
python3 -m pip install termcolor
It downloads into a folder:
./.local/lib/python3.7/site-packages
I would now like to use termcolor in IDLE.
I have not been able to successfully change the directory that termcolor gets downloaded into therefore it was difficult to access within IDLE. However, I was able to use the following command to access that directory:
import sys
sys.path.append(('./.local/lib/python3.7/site-packages'))
I was then able to import termcolor and use it a little. However, when I try to do something like:
print(termcolor.colored('hi'))
I get the result:
hi[0m
I would like to try and get everything sorted out since as I progress towards more advanced modules, I would like to not run into similar problems. I have though about getting a different laptop such as a mac to maybe simplify things since Chromebook may make things more difficult for beginners.
So my questions would be:
1) Can I add into IDLE pathbrowswer ./.local/lib/python3.7/site-packages?
2) How do I correct so I do not get hi[0m as a result?

cv2 and opencv Python troubleshooting install

I'm totally new to python. Currently I'm trying to install a packaged named cv2/openvc. Having migrated from Rstudio I'm trying to use rodeo in the same way for python. Python definitely seems less user friendly.
When I try to import the package from rodeo and I get following error:
However, when I run python from the windows cmd line and all works fine, I can even import cv2 and check the version.
Why is this and how can I fix it?
I can say the best thing you can do is to really know which python installation is being used by Rodeo. However, if you are in hurry you can install cv2 within the python interpreter by this code:
import sys
import subprocess
subprocess.call([sys.executable, "-m", "pip", "install", "opencv-python"])

Raspberry Pi 3: OpenCV 3.4.0 missing some files after installation and can't be called within my code

I hope you're doing good.
I've been working on a robot for couple of months and got it working properly recently.
Sadly, my code got deleted including all libraries, tried to install OpenCV couple of times but I'm still getting errors
I used this link to install OpenCV 3.4.0 with the latest version of Raspbian https://www.life2coding.com/install-opencv-3-4-0-python-3-raspberry-pi-3/
ImportError: libavcodec.so.56: cannot open shared object file: No such
file or directory
Is there a proper way to install all libraries ? I'll include all libraries I used at the beginning of the code below.
Thanks in advance
[import cv2
import cv2.cv as cv
import numpy as np
from gopigo import *
import sys
import RPi.GPIO as GPIO
import time
import os
import multiprocessing as mp
Could be that you installed an old/wrong version of opencv, or it could be that you installed the base version, without the extra modules.
I would advice installing use pip, always works for me. In that case the following command should be enough:
pip install opencv-contrib-python
Note: you need to uninstall openCV first. Read more about the installation here
If you dont know what pip is, read about it and install from here
I was using 'Raspbian Stretch Lite' but didn't work, I might have missed something up while installing OpenCV library
I tried latest version of 'Raspbian Stretch with desktop and recommended software' from Raspberrypi's website https://www.raspberrypi.org/downloads/raspbian/
and followed all steps stated here to install OpenCV https://www.pyimagesearch.com/2017/09/04/raspbian-stretch-install-opencv-3-python-on-your-raspberry-pi/
Once done with OpenCV use this command within your code to relocate packages
import sys
sys.path.append('/usr/local/lib/python2.7/site-packages')
OpenCV is working fine to me now. Thanks to J.D. and Jayjayyy for guiding me and helping me to solve this issue, I really appreciate your help :)

How to import pygame, pyperclip?

I am fairly new to python but am having issues importing certain packages within my code. I try to import pyperclip aswell as pygame. I've installed them both manually and I've tried importing them using import pygame and import pyperclip and I get
"no module named 'pyperclip'"
and the same thing for pygame. I've tried opening by putting just import pygame and saved it to run it in the interactive shell and I've also just tried typing it into the interactive shell.
I'm running linux mint 17.3 and python 2.7.6
Has anyone else had this issue?
Any help would be appreciated. Za
I had the same problem. I am also new to Python and programming. I tried about 100 things, but what worked for me was typing the following in the command shell:
pip install pyperclip
That was it. However, I was using Windows' command module, so. . . you know. But it's worth a shot!
This link might help, too (it has Linux instructions, etc): https://github.com/asweigart/pyperclip

Using Import for PIP Installed Packages While Using Kivy on Windows

I am trying to use the Python module pyowm with Kivy and am having problems getting the import statement to work. I am on Windows 8.1 and downloaded pyowm using PIP. When I try and use "import pyowm" and then send the file to Kivy.bat it says "No module named pyowm" but when I just run a program that uses only pyowm from command line it works.
Any help would be greatly appreciated.
Cheers
The kivy portable package includes its own python, but it sounds like you have installed pyowm into some other python installation.
I haven't used the windows package, but I think somewhere in it there should be a way to run its internal pip. If nobody responds here, someone on the kivy mailing list or irc probably knows.

Categories

Resources