Python Forum
Thread Rating:
  • 1 Vote(s) - 2 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Can't get pip to work
#1
I just started teaching myself how to program, and I'm using Python 3.6 and Windows 10.  I want to use pip to install the pyperclip module.  I know I can download the zip file to install pyperclip, but that's not the whole point.  I also want to learn how to use pip.  However, when I tried to do the installation, I got a SyntaxError.  I downloaded and ran get-pip.py to make sure I had all the scripts and tools I needed for this, but I still get the same error.  Below is a copy of my command line.  Can someone please help me figure out what is going wrong?


Python 3.6.1 (v3.6.1:69c0db5, Mar 21 2017, 17:54:52) [MSC v.1900 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> python -m pip install pyperclip
  File "<stdin>", line 1
    python -m pip install pyperclip
                ^
SyntaxError: invalid syntax
>>> pip install pyperclip
  File "<stdin>", line 1
    pip install pyperclip
              ^
SyntaxError: invalid syntax
>>> pip install 'pyperclip'
  File "<stdin>", line 1
    pip install 'pyperclip'
              ^
SyntaxError: invalid syntax
>>>
Reply
#2
(May-09-2017, 01:58 AM)KBingo Wrote: >>> python -m pip install pyperclip
pip is not ran through the python interpreter (ie the >>> prompt), but your system command line. Search on your windows cmd and navigate to your installed python directory
Recommended Tutorials:
Reply
#3
(May-09-2017, 02:35 AM)metulburr Wrote:
(May-09-2017, 01:58 AM)KBingo Wrote: >>> python -m pip install pyperclip
pip is not ran through the python interpreter (ie the >>> prompt), but your system command line. Search on your windows cmd and navigate to your installed python directory

Okay, I looked up how to navigate in my system's command prompt, but I can't navigate to my Python directory.  I've already added "C:\Users\Kelly Martin\AppData\Local\Programs\Python\Python36-32\Scripts" as a Path in my system variables, but when I try to navigate there, I get the error "The system cannot find the path specified."  I've copy-pasted the command lines below.


C:\>cd\users\kelly martin

C:\Users\Kelly Martin>cd\appdata\local\programs
The system cannot find the path specified.

C:\Users\Kelly Martin>cd\AppData\Local\Programs\Python\Python36-32\Scripts
The system cannot find the path specified.

C:\Users\Kelly Martin>
Reply
#4
pip does not care which folder are you in - as long as your PATH (or its DOS equivalent) points to your Python directory. If it is not - there's a problem with your installation
Test everything in a Python shell (iPython, Azure Notebook, etc.)
  • Someone gave you an advice you liked? Test it - maybe the advice was actually bad.
  • Someone gave you an advice you think is bad? Test it before arguing - maybe it was good.
  • You posted a claim that something you did not test works? Be prepared to eat your hat.
Reply
#5
(May-09-2017, 03:26 AM)KBingo Wrote: I've already added "C:\Users\Kelly Martin\AppData\Local\Programs\Python\Python36-32\Scripts" as a Path in my system variables,
There should be no need to add path manually with 3.6 installation.
Add Python 3.6 to Path should be marked under installation.

I would uninstall and choose a better path eg C:\Python36
Follow this.
Make sure that Add python 3.6 to Path and pip is marked on.
Restart.
Test that python and pip work from cmd.
Microsoft Windows [Version 10.0.14393]
(c) 2016 Microsoft Corporation. Med enerett.
  
C:\Windows\System32>cd\
  
C:\>python
Python 3.6.0 (v3.6.0:41df79263a11, Dec 23 2016, 07:18:10) [MSC v.1900 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> exit()
  
C:\>pip -V
pip 9.0.1 from c:\python36\lib\site-packages (python 3.6)
C:\>
Reply
#6
First, why did you install Python 32 bit when usually Windows 10 is 64 bit?
Secondly, go to 'File Manger' (right click on start button and select "File Manager".
In the search box in the upper right hand corner, type in "python.exe" (this will take a while), there should be two entries, python.exe and pythonw.exe in the same directory (ignore any directory with 'cache' in it).  This should be the location of your Python installation and should be included in your System Environmental varialble as well as the path to ~\Scripts directory
Next, ensure that pip is installed, luckily Python includes a module for that called, surprisingly, ensurepip
From the command line, type:
python -m ensurepip
if it is correctly installed you will see something similar to this:
Microsoft Windows [Version 10.0.14393]
(c) 2016 Microsoft Corporation. All rights reserved.

C:\>python -m ensurepip
Requirement already satisfied: setuptools in c:\python36\lib\site-packages
Requirement already satisfied: pip in c:\python36\lib\site-packages
Requirement already satisfied: six>=1.6.0 in c:\python36\lib\site-packages (from setuptools)
Requirement already satisfied: appdirs>=1.4.0 in c:\python36\lib\site-packages (from setuptools)
Requirement already satisfied: packaging>=16.8 in c:\python36\lib\site-packages (from setuptools)
Requirement already satisfied: pyparsing in c:\python36\lib\site-packages (from packaging>=16.8->setuptools)

C:\>
if it is not installed, it will install it.  If it has to install it, it will not be the most recent version, so you have to type
pip install --upgrade pip
If it still fails, uninstall Python and reinstall paying close attention to the installation process.
1- Make sure you check the Install pip box
2- Make sure you check the box to add Python to the Environmental variables
3- Change the (really truely crappy) default installation directory to something better...like C:\Python36
If it ain't broke, I just haven't gotten to it yet.
OS: Windows 10, openSuse 42.3, freeBSD 11, Raspian "Stretch"
Python 3.6.5, IDE: PyCharm 2018 Community Edition
Reply
#7
(May-09-2017, 01:46 PM)sparkz_alot Wrote: First, why did you install Python 32 bit when usually Windows 10 is 64 bit?
I always install 32 bit for windows. The only reason I use python on windows is to create an exe for windows users. And pygame + py2exe doesnt play well with 64 bit.

(May-09-2017, 07:33 AM)volcano63 Wrote: pip does not care which folder are you in - as long as your PATH (or its DOS equivalent) points to your Python directory. If it is not - there's a problem with your installation
It can get confusing if you have more than one version. I always navigate to my python directory and execute it from Scripts as i have numerous python installs.
Recommended Tutorials:
Reply
#8
(May-09-2017, 01:23 PM)snippsat Wrote:
(May-09-2017, 03:26 AM)KBingo Wrote: I've already added "C:\Users\Kelly Martin\AppData\Local\Programs\Python\Python36-32\Scripts" as a Path in my system variables,
There should be no need to add path manually with 3.6 installation.
Add Python 3.6 to Path should be marked under installation.

I would uninstall and choose a better path eg C:\Python36
Follow this.
Make sure that Add python 3.6 to Path and pip is marked on.
Restart.
Test that python and pip work from cmd.
Microsoft Windows [Version 10.0.14393]
(c) 2016 Microsoft Corporation. Med enerett.
  
C:\Windows\System32>cd\
  
C:\>python
Python 3.6.0 (v3.6.0:41df79263a11, Dec 23 2016, 07:18:10) [MSC v.1900 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> exit()
  
C:\>pip -V
pip 9.0.1 from c:\python36\lib\site-packages (python 3.6)
C:\>

This should be a tutorial....this is repeated so many times. Also since what version of python came with a checkbox to add python to PATH? I remember having to tell people to do it manually.
Recommended Tutorials:
Reply
#9
You have to click on "Customize" on the initial Installation Dialog.  Not sure when it first appeared, but I want to say it's always been there at least since v3.0
If it ain't broke, I just haven't gotten to it yet.
OS: Windows 10, openSuse 42.3, freeBSD 11, Raspian "Stretch"
Python 3.6.5, IDE: PyCharm 2018 Community Edition
Reply
#10
(May-09-2017, 02:34 PM)metulburr Wrote: This should be a tutorial....this is repeated so many times.
Can make a tutorial,made it here.
Give feedback if missing anything.
Reply


Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020