Reputation: 141
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.
Upvotes: 5
Views: 42617
Reputation: 81
//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
Upvotes: 0
Reputation: 34155
pip install ...
is not python code. You have to run it from the terminal/command prompt.
Upvotes: 4
Reputation: 342
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()
Upvotes: 0
Reputation: 2080
Could be that you are using "Jupyter notebook" ? . Jupyter doesn't support all the modules in python like (tkinter , pyperlip .. and much more others)
Upvotes: 1
Reputation: 33
This method is better:
C:\Users\YourUserName\AppData\Local\Programs\Python\Python36-32\lib
I guess you are good to go
Upvotes: 2
Reputation: 21
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
Upvotes: 1
Reputation: 1
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.
Upvotes: 0
Reputation: 11
Don't Write it inside python.exe
Just open the command prompt and write pip install pyperclip
Upvotes: 0
Reputation: 94
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!
Upvotes: 6