Python 3.5 Pyperclip module import failure - python

Just started learning Python. And i'm having trouble using the Pyperclip module.
When I tried to use the pip install pyperclip in the command line, it shows up this error:
pip install pyperclip
^
SyntaxError: invalid syntax
I am running Python 3.5 (32 bit) on a Windows 7 desktop.

open command prompt
type: pip install pyperclip
if this doesn't work then do this use
cd Python35/Scripts to get to the scripts folder
This is the folder where pip is located.
Now type: pip install pyperclip
This will download and install pyperclip
now type: pip freeze
And pyperclip should be listed
If you want to test in python shell remember to close the shell(if open) and open new one because it needs to load the new package.
type in python shell: import pyperclip
it should accept it and now you can pyperclip.copy() and pyperclip.paste()
Good luck!

sudo pip3 install pyperclip
did the trick for me

pip install ... is not python code. You have to run it from the terminal/command prompt.

This method is better:
Download the zip file of the pyperclip from
https://pypi.python.org/packages/8b/4b/8ab1608291f863c501b02af3a607ae43e8e7134a266804b4c8c452feb84f/pyperclip-1.5.7.zip#md5=678e42420aa569b15e82636dc73ed7c5
Extract the file and copy to
C:\Users\YourUserName\AppData\Local\Programs\Python\Python36-32\lib
Copy the pyperclip the python file into the lib folder
Try the import pyperclip on the python shell again.
I guess you are good to go

For me, this installed pip at C:\Users\YourUserName\AppData\Local\Programs\Python\Python36-32\Scripts\pip.exe.
Find pip.exe on your computer, then add its folder (for example, C:\Users\YourUserName\AppData\Local\Programs\Python\Python36-32\Scripts) to your path (Start / Edit environment variables).
Now you should be able to run pip from the command line. Try installing a package;
Open default commandline and type:
pip install pyperclip

Could be that you are using "Jupyter notebook" ? . Jupyter doesn't support all the modules in python like (tkinter , pyperlip .. and much more others)

Don't Write it inside python.exe
Just open the command prompt and write pip install pyperclip

sudo apt-get install python3-pip
sudo pip3 install --upgrade pip
sudo pip3 install setuptools
sudo pip3 install pyperclip
This is what I had to do to get pyperclip to work on a Linux Mint box.

It sounds like you're trying to run a python script.
add the pyperclip package to python using:
$ pip install pyperclip
If you run the command again you should get this message. If not then address the error by installing the additional packages it asks for.
In the script you want to run, make sure you import the package to be able to access. In your file you should have:
import pyperclip
# What ever commands you want to run
pyperclip.copy('Hello, world!')
pyperclip.paste()

//These below three commands worked for MacBook Pro to install Pip & Pyperclip
1./Library/Frameworks/Python.framework/Versions/3.9/bin/python3.9 -m pip install --upgrade pip
2./Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/scripts
3.sudo pip3 install pyperclip
output:
Downloading pip-21.2.4-py3-none-any.whl (1.6 MB)
|████████████████████████████████| 1.6 MB 3.7 MB/s
Installing collected packages: pip
Attempting uninstall: pip
Found existing installation: pip 21.2.3
Uninstalling pip-21.2.3:
Successfully uninstalled pip-21.2.3
Successfully installed pip-21.2.4
Collecting pyperclip
Downloading pyperclip-1.8.2.tar.gz (20 kB)
Using legacy 'setup.py install' for pyperclip, since package 'wheel' is not installed.
Installing collected packages: pyperclip
Running setup.py install for pyperclip ... done
Successfully installed pyperclip-1.8.2

Related

Unable to install Requests module in python2.7 (Kali linux) as it keeps appearing in python3 library

I am using kali linux and is trying to import a module called requests to run an exploit. (https://www.exploit-db.com/exploits/47138) if you want to know more about the exploit.
when i try to run the following command
sudo pip install requests
i kept getting this result
Requirement already satisfied: requests in /usr/lib/python3/dist-packages (2.23.0)
this cant work at all as i requires the Requests module to be in python2.
How can i get it installed?
pip install <package> -t <directory>
-t specifies the target directory where you want your package to be installed
So in your case you can do pip install requests -t "C:\Python27\Lib\site-packages" (This is where my site-packages folder is.)
You should use this command, it will ensure you are installing the module for python2:
python2 -m pip install --user --upgrade requests
You could use the following command:
sudo pip2.7 install requests
(Assuming that you have Python 2.7. If you have a different version, swap out the version number)

Q: Command Line says "Failed to created process" when I try to pip install a package

5 and having no problems but I'm on windows 10 and I read online that I can't edit the system variables to add to the path to run programs from command line easily. I decided to uninstall python 3.5 and install python 3.8.2, which is the latest version, so that I could click on the “add to path” option.
The install went okays, but when I tried to go to the command prompt and install third party packages using pip, the command prompt kept saying "failed to create process"
I tried repairing the installations, trying different versions but the same thing kept happening.
Is there a fix for this? Help...
Thanks
C:\\WINDOWS\\system32>pip install pyperclip
failed to create process.
C:\\WINDOWS\\system32>
You will need to install the 64 bit python 3.8 dev module on the microsoft store, as the install from python webpage was most likely 32bit.
here is the link: https://www.microsoft.com/store/productId/9MSSZTT1N39L
C:\Users\Ben Woo>pip install pyperclip
Collecting pyperclip
Downloading https://files.pythonhosted.org/packages/f6/5b/55866e1cde0f86f5eec59dab5de8a66628cb0d53da74b8dbc15ad8dabda3/pyperclip-1.8.0.tar.gz
Installing collected packages: pyperclip
Running setup.py install for pyperclip ... done
Successfully installed pyperclip-1.8.0
WARNING: You are using pip version 19.2.3, however version 20.0.2 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.
C:\Users\Ben Woo>

Command "pip3 install --user guizero" fails: "No matching distribution found"

I have to install the module guizero for a piece of Python homework I've been given but it's not working.
This is all on Terminal on my Mac, version 10.7.5
People have said that I go to Library/Python but this is another problem. My MAC doesn't show me any folders named Python in Library. This is what the Library Folder looks like:
Library Folder
The command I'm using is
pip3 install --user guizero
and I get this error:
Could not find a version the satisfies the requirement guizero (from versions: )
No matching distribution found for guizero
Can anyone help with this?!
Try to update your pip version:
pip install --upgrade pip
Or pip install guizero version==0.2.1
Pip can't just magically invent what guizero is. You need to download guizero-0.2.1-py3-none-any.whl from https://pypi.python.org/pypi/guizero. Save it in your Library/Python/2.5/site-packages (replace 2.5 with your version) folder and then type pip install guizero-0.2.1-py3-none-any.whl in the terminal (typing guiz and tab twice should auto complete the file name for you)
EDIT
First install easy_install
curl https://bootstrap.pypa.io/ez_setup.py -o - | sudo python
Then install pip
sudo easy_install pip
You can now install any module using
pip install guizero

Installing requests-kerberos on Windows

Is there any way to install requests-kerberos on Windows?
When I try to install it with pip I have the following error:
py -m pip install requests-kerberos
ImportError: No module named 'commands'
Command "python setup.py egg_info" failed with error code 1 in C:\Users\user1\AppData\Local\Temp\pip-build-n8s_inn\kerberos
I would be grateful if anyone knew another kerberos module. I'm using Python 3.4 and Windows 8.
Best regards.
The commands module was deprecated in python 2.6.
Thus, the issue appears to be a problem with your pip installation, and not with requests-kerberos.
There are a few things you can try, but I would focus on ensuring pip is working correctly. While you could install the package manually, you are really just pushing the pip problem down the road until the next time you install a package.
Ensure pip is installed correctly.
Use the pip command to ensure you are running pip in the python 3.4 context: (Note, this is my output, yours will be different because you are on Windows and running 3.4)
$ pip --version
pip 1.5.6 from /Library/Python/2.7/site-packages/pip-1.5.6-py2.7.egg (python 2.7)
Additional information about pip can be found here.
Download and install manually
Download the package manually from the pypi repo.
Download the .tar.gz
Extract the tar.gz and run python setup.py install

Python can't find module NLTK

I followed these instructions http://www.nltk.org/install.html to install nltk module on my mac (10.6)
I have installed python 2.7, but when I open IDLE and type import nltk it gives me this error
Traceback (most recent call last):
File "<pyshell#0>", line 1, in <module>
import nltk
ImportError: No module named nltk
The problem is the module is installed in another python version, 2.6. How can I install the package in python version 2.7? I tried some of the solutions suggested in various answers, for example I tried typing this in the terminal
export PYTHONPATH=$PYTHONPATH:/usr/local/lib/python2.7/site-packages
and then installed NLTK again with the command
sudo pip install -U nltk
but I get the message: Requirement already up-to-date in /Library/Python/2.6/. So apparently the command line export PYTHONPATH didn't do anything (it still tries to install the package in 2.6) OR (more likely) I didn't understand the meaning/functioning of that command line. What am I doing wrong?
On OS X you could have multiple installation of Python, so investigate it first:
$ which python python2 python3
/usr/bin/python
/usr/local/bin/python3
$ which pip pip2 pip3
/usr/local/bin/pip
/usr/local/bin/pip2
/usr/local/bin/pip3
All within /usr/bin are built-in and all other in /usr/local/bin are external installed by Homebrew or some other package manager.
If you're using pip or pip3 from /usr/local, then you've to use the same Python instance, otherwise they're different instances.
Just install it via pip:
pip install nltk
or for Python 3:
pip3 install nltk
then run the right Python instance from /usr/local/bin or update your PATH system variable.
Make sure you install the actual Python for Mac, not the one built into the console. Then, install pip by executing this script. Then skip to part 3 of the instructions and go from there.
Try this
pip install --user -U nltk
On my mac I had two different versions of Python 3 installed: Python 3.6 and Python 3.7. I had installed nltk having Python 3.7 in my $PATH:
$ pip3 install nltk
$ which python3
/Library/Frameworks/Python.framework/Versions/3.7/bin/python3
$ echo $PATH
/Library/Frameworks/Python.framework/Versions/3.7/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
But nltk was missing for Python 3.6. Solution: install nltk also for version 3.6.
$ echo $PATH
/Library/Frameworks/Python.framework/Versions/3.6/bin:/Library/Frameworks/Python.framework/Versions/3.7/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
$ pip3 install nltk
Collecting nltk
Using cached https://files.pythonhosted.org/packages/6f/ed/9c755d357d33bc1931e157f537721efb5b88d2c583fe593cc09603076cc3/nltk-3.4.zip
Requirement already satisfied: six in /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages (from nltk) (1.12.0)
Collecting singledispatch (from nltk)
Using cached https://files.pythonhosted.org/packages/c5/10/369f50bcd4621b263927b0a1519987a04383d4a98fb10438042ad410cf88/singledispatch-3.4.0.3-py2.py3-none-any.whl
Installing collected packages: singledispatch, nltk
Running setup.py install for nltk ... done
Successfully installed nltk-3.4 singledispatch-3.4.0.3
I would use a virtualenv, but if you really want to use it from the terminal, I'd recommend adding your export statement to ~/.bashrc
Just restart Jupyter Notebook or anything you are using after installing...
It works...
In my case, the following command worked for me. Try this!!
py -3 -m pip install nltk
I had a similar issue an an Intel MacBook.
Fixed with
Make sure the python bin directory in the path
mine is /Users/<user>/Library/Python/3.9/bin
Restart the computer
NOTE that just restarting the terminal did NOT help

Categories

Resources