1

Im on windows 8 and i have installed the latest python,and im going to use sublime text 3 as my ide to create a website using flask.But firstly i needed to install a virtual enviroment using this command pip install virtualenv,and this is the response i recived by cmd.

C:\Users\osman_000>pip install virtualenv
'pip' is not recognized as an internal or external command,
operable program or batch file.

C:\Users\osman_000>

Please can someone help if you know how to fix this,as im not excatly sure what do from here thanks.

  • You need to give the absolute path for pip.exe. For example mine is C:\Python27\Scripts\pip.exe Or you could run the command from that directory. – Farhan.K Mar 10 '16 at 14:58
  • How do I locate that as I'm not sure where it is –  Mar 10 '16 at 14:58
  • It depends on where you installed Python. I think the default directory is C:\Python27 – Farhan.K Mar 10 '16 at 14:59
  • You can find out where you installed python by using `import sys` `print(sys.executable)` – Farhan.K Mar 10 '16 at 15:03
  • I opened up the scripts location but I did uninstall p2 with and already have p3 –  Mar 10 '16 at 15:04

1 Answers1

2

Under Windows, pip is stored in the Python scripts folder, e.g. "C:\Python27\Scripts".

How to run pip?

  • Open a Command line by pressing [WIN]+R and typing cmd.exe.

  • Then navigate tho the Scrips folder of your Python installation by typing cd "C:\Python27\Scripts" (Or where else you've installed Python) into the command line.

  • To run pip now type pip.exe into the command line. This should print a help message.

  • If so, you can use pip install package_name to install a Python package.

What I recommend:

Navigating to the Scripts folder every time is very annoying, so you can tell Windows where your pip.exe is stored.

  • Open the control panel, search for "environment variables" and choose edit environment variables.

  • When a little window is opened, press the button "Environment variables" on the bottom.

  • Now, double-click the entry "Path", click "New" and enter "C:\Python27\Scripts" (If this is your intallation path, see above). Close all windows with clicking "OK", you're done!

  • Now opening a commandline and installing through pip should work.

Hope this helps!

linusg
  • 6,289
  • 4
  • 28
  • 78
  • I opened up the path and I have multiple options in the scripts folder do I run any of them –  Mar 10 '16 at 15:01
  • So I just type the path location into cmd –  Mar 10 '16 at 15:02
  • In your Scripts folder you should have a file called `pip.exe`. This is the file you want to run. Now you have two options: 1. Always go to the Scripts folder and run that file or 2. Add C:\Python27\Scripts to the windows environment variable PATH – linusg Mar 10 '16 at 15:05
  • I have 3 pips 1.pip 2.pip.27 3.pip2 which one do I run and I did uninstall Python 2 –  Mar 10 '16 at 15:07
  • pip is the one you want – Farhan.K Mar 10 '16 at 15:09
  • pip.exe is the one which is running with typing `pip` into the cmd – linusg Mar 10 '16 at 15:09
  • but you said you have pip, pip.27 and pip3?? – linusg Mar 10 '16 at 15:14
  • Ok thanks I double clicked on pip but it closed quickly to see what it said –  Mar 10 '16 at 15:16
  • You have to open the cmd first, the go to the Scripts folder using `cd`, and the you can use `pip install` or whatever – linusg Mar 10 '16 at 15:18
  • You have to run it from cmd. – Farhan.K Mar 10 '16 at 15:19
  • Thanks but for the record I did uninstall Python 2.7 and have the newest version wil that cause chaoes for future purposes –  Mar 10 '16 at 15:27
  • You will need to install `virtualenv` using the python 3 pip. It should be in C:\Python34\Scripts. You can add this into your PATH by following linusg's instructions. – Farhan.K Mar 10 '16 at 15:39
  • Please can you proceed with code after the following C://Users/osman_000> –  Mar 10 '16 at 15:52
  • 1
    Do it as I wrote in the answer or say what's not clear enough – linusg Mar 10 '16 at 15:55
  • It's a bit hard to format with my cmd can repeat the code after the following from start to finish using the default directory –  Mar 10 '16 at 15:56
  • Huh?? I think it's easier for you to add the Scripts folder to the Path variable, just do it as I wrote in the second part of my answer – linusg Mar 10 '16 at 15:59
  • Thanks but there's 2 options under system edit environment variables for your account or edit system environment variables –  Mar 10 '16 at 16:09
  • choose system environment variables not those for your account – linusg Mar 10 '16 at 16:10
  • So like this click on edit system the environment variables click on environment variables on the bottom and I get another option user variable or system variable and is it edit or new –  Mar 10 '16 at 16:16
  • click new and enter your python's installation path – linusg Mar 10 '16 at 16:17
  • Variable name or value –  Mar 10 '16 at 16:21
  • first double-click the entry "Path" and then press new not the new below the entries "Path" is in – linusg Mar 10 '16 at 16:25
  • If you create a per-user `PATH`, it gets concatenated to the system `PATH`. – Eryk Sun Mar 10 '16 at 19:42