Not sure how to fix this Cmd command error?

2019-08-15 16:59发布

问题:

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.

回答1:

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!