0

I am trying to install pip for python in windows 7. I installed it and I added "C:\PythonXX\Scripts" to the windows path variables. But, when I typed "pip" in the command prompt it shows that pip is not recognized as an internal or external command.

Is there any way to figure out this problem?

Bibek Ghimire
  • 472
  • 1
  • 4
  • 19
User94
  • 39
  • 1
  • 9
  • 1
    This is pretty common for windows. Execute pip like this: python -m pip (pip_args) – King Natsu Jun 23 '17 at 00:30
  • 1
    Or try restarting your computer, sometimes path stuff can be weird and not update in certain apps until you restart – Keith M Jun 23 '17 at 00:34
  • 1
    @KeithM My bad, the cmd need to be restared to load the changes to the path variables – King Natsu Jun 23 '17 at 00:46
  • 1
    Yep that would be the problem :) sometimes the problem can extend beyond the cmd so I usually just tell people to restart in general – Keith M Jun 23 '17 at 00:48
  • @risingprogrammer thank you for your help. I tried the command: python -m pip (pip_args) but it shows: no module named pip. – User94 Jun 23 '17 at 01:12
  • @KeithM thank you for your help. I tried restarting my computer but it doesn't work. – User94 Jun 23 '17 at 01:13
  • 1
    Then you probably need to install pip. See this question for more info https://stackoverflow.com/q/4750806/4833867 – King Natsu Jun 23 '17 at 01:17
  • Like he said you probably haven't installed pip right, or you put the wrong directory on the path – Keith M Jun 23 '17 at 04:11
  • @risingprogrammer In the link that you sent, it is mentioned: "Download get-pip.py, being careful to save it as a .py file rather than .txt". I actually did these steps: right click to the "get-pip.py" link and save the link as. But, it doesn't work, the pip was not installed successfully. – User94 Jun 23 '17 at 13:09
  • Did you open the cmd as administrator? If not please retry it as admin or look at the alternative instructions. – King Natsu Jun 23 '17 at 13:26
  • @risingprogrammer I did that using cmd as administrator but it stills the same error. – User94 Jun 23 '17 at 14:03

2 Answers2

0

if you have already installed python of whatever version you can skip ahead to step 4 or step 6.

  1. download and install python default installation is c:\python27
  2. Create a new System Variable named Variable name: PYTHON_HOME and Variable value: c:\Python27 (or whatever your installation path was)
  3. Find the system variable called Path and click Edit
  4. Add the following text to the end of the Variable value:;%PYTHON_HOME%\;%PYTHON_HOME%\Scripts\
  5. Verify a successful environment variable update by opening a new command prompt window (important!) and typing python from any location
  6. Download get-pip.py to a folder on your computer. Open a command prompt window and navigate to the folder containing get-pip.py. Then run python get-pip.py. This will install pip.
  7. verify your pip installation: open command prompt and type 'pip freeze' without quotation and if it shows like

    antiorm==1.1.1

    enum34==1.0

    requests==2.3.0

    virtualenv==1.11.6
    then you are successful. if above steps failed than update environment variable. go to Control Panel\System and Security\System select advance system setting then select environment variable and add c:\python27\scripts to path variable then it will be fine. i have tested it successfully on my pc.

Bibek Ghimire
  • 472
  • 1
  • 4
  • 19
  • 1
    Thank you for your help. I actually did these steps. But, I think the problem is from the installation of pip. I download pip from this site: "https://pip.pypa.io//en/latest/installing/", then right click to the "get-pip.py" link and save link as. After that, when I clicked to the "get-pip.py" which is already download, a command prompt is opened and shows "invalid syntax". Is there a step missing or something I've done wrong ? – User94 Jun 23 '17 at 12:53
  • follow the steps i have told you. executing by doubleclicking shows errors which i have also faced. in your cmd type 'python get-pip.py' it will be fine than. @Christine – Bibek Ghimire Jun 23 '17 at 13:39
  • I followed the steps that you mentioned, I typed 'python get-pip.py' in the cmd, but always the same error: http_error_msg = u'%s Client Error: u'%s for url: %s' % (self.status_code, reson, self.url) SyntaxError: invalid syntax". – User94 Jun 23 '17 at 14:02
  • I don't know why it still doesn't work despite I followed all the steps. – User94 Jun 23 '17 at 14:20
  • did you add C:\python27\scripts to system path variable – Bibek Ghimire Jun 23 '17 at 14:23
  • which version of python you are using – Bibek Ghimire Jun 23 '17 at 14:31
  • I'm using Python3.1 – User94 Jun 23 '17 at 14:33
  • check all works fine, run python from cmd. iit works add python installation directory \scripts to system path variable and try running pip. if you still have problem than try different versions of python. i have also faced too many problems with pip. you can also try 'import pip' from python idle or python shell. if import ok then you can also install python packages from python shell. import pip and type pip.main(['install','package_name']) . latest release python 3.6.1 is also fine – Bibek Ghimire Jun 23 '17 at 14:46
  • I download another version Python3.4 and then when I typed the command "get-pip.py" it shows: "Requirement already up-to-date: pip in c:\python34\lib\site-packages". Is that mean that pip is installed successfully ? – User94 Jun 23 '17 at 16:17
  • Everything is going right, pip was installed successfully. Thank you for your help. – User94 Jun 24 '17 at 00:18
-1

I know it's hustle to install pip in Windows. With latest Python you don't need to install pip, it's now prebuilt and you can access it by python -m pip

ppc
  • 1
  • 1
  • 2