62

I tried to install PySide but I got error from the powershell as follows:

pip : The term 'pip' is not recognized as the name of a cmdlet, function, script file, or 
operable program. Check the spelling of the name, or if a path was included, verify that 
the path is correct and try again.
At line:1 char:1
+ pip install -U PySide
+ ~~~
    + CategoryInfo          : ObjectNotFound: (pip:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException
wjandrea
  • 28,235
  • 9
  • 60
  • 81
Mohd Rais
  • 631
  • 1
  • 5
  • 4

14 Answers14

96

This error shows up on windows when one tries to use pip in the command prompt. To solve this error on windows, you must declare path variable by following these steps:

  1. Right click on My Computer or This PC
  2. Click on Properties
  3. Click on Advanced System Settings

You will find a section called system variables. Click on Path from the list of variable and values that shows up there.

After clicking on path click edit. You will find a New button in the pop up.

Click that and paste the location of the python35 or python36 folder (The location you specified while installing python) followed by \Scripts there.

For me its C:\Users\a610580\AppData\Local\Programs\Python\Python35-32 so I type C:\Users\a610580\AppData\Local\Programs\Python\Python35-32\Scripts

Click Ok to close all windows and restart your command prompt.

I repeat - restart your command prompt.

Everything should now be working fine! Make sure you don’t disturb anything else in the path variable and follow the aforementioned steps exactly.

Alternatively you can watch this video.

wjandrea
  • 28,235
  • 9
  • 60
  • 81
Haris Ali Khan
  • 1,291
  • 9
  • 12
  • 7
    Restarting the command prompt is important, even opening a new tab (as in the new Microsoft terminal) will not work – STG Jul 20 '20 at 16:28
  • This does have any dependency of having admin rights. – Rahul Apr 28 '22 at 06:06
  • 1
    @Rahul You can add user-environment variables separately from system ones. Only system ones require admin rights – OneCricketeer Jul 13 '22 at 17:51
  • I don't think it's a good idea to put a user-specific path in the system variables, though I don't use Windows. If you've installed Python system-wide, edit the system variable, but if you've installed it only for your user, edit the user variable. Or, I think the Python installer can take care of this for you, so you could try running the installer again / reinstalling. – wjandrea Jan 07 '23 at 03:24
  • Somewhy Cmd worked properly after adding Python to PATH, but VSCode terminal still doesn't have the right configuration to handle pip. What can I do about it? – Helen Kapatsa Jun 20 '23 at 14:33
46

According to the pip documentation, rather than running pip directly, you just need to type

py -m pip

in your Python terminal. Then you will see a list of things you can do.

screenshot of IDE terminal showing the output

wjandrea
  • 28,235
  • 9
  • 60
  • 81
Geographos
  • 827
  • 2
  • 23
  • 57
  • Superb Answer. This does not have any dependency of having admin rights. Thank You So much. – Rahul Apr 28 '22 at 06:05
18

That's because the path where pip.exe is, is not in your system PATH variable so cmd can't find pip a simple fix will be to change to the directory where pip.exe and run if from there like this

cd C:\Python27\Scripts

But a better solution is to add it to your PATH variable. Open Command prompt with admin rights and run

setx path "%PATH%;C:\Python27\Scripts;"

that adds python to your PATH, you can check the lists of paths in your path variable by running

echo %path%

You should see your newly added path there. Don't forget to restart command prompt after you're done.

Now you should be able to run pip.

danidee
  • 9,298
  • 2
  • 35
  • 55
12

Basiclly, You need to add the path of your pip installation to your PATH system variable.

First Option

Download pip by modifying the Pyton Installation.

Step 1 - Open Apps & Features

Step 2 - Find Python and click on it

Step 3 - Press Modify

Step 4 - Select pip

Step 5 - Select Add Python to environment variables and install everything

This will install pip and add both, Python and pip to your envirnoment variables.

Second Option

By default, pip is installed in C:\Python34\Scripts\pip

To add the path of your pip installation to your PATH variable follow theese steps.

Step 1 - Search for environment variables and open Edit the system environment variables

Step 2 - Open Environment Variables...

Step 3 - Find your PATH variable and select Edit

Step 4 - Paste the location to your pip installation (By default, it's C:\Python34\Scripts\pip)

Zimbakov Tech
  • 157
  • 1
  • 10
6

Just reinstall python and click add to PATH in the installer!

Reek
  • 61
  • 1
  • 1
4

I discovered that using powershell PIP wasn't recognized, but in the CMD it is.

Make sure you're actually using the cmd and not powershell to run it.

Insadrian
  • 74
  • 3
3

Try this. It worked for me installing another library:

  1. Open the CMD as Administrator by one of the following methods:

Method 1:

  • Open Start menu and search for "CMD"
  • Right click and choose "Run as Administrator

Method 2:

  • Press from the keyboard: "Windows Key + R"
  • Type "cmd" and Press "Ctrl+Shift+Enter"
  1. Type “cd\” and press "Enter"
  2. Locate your Python application path, which is the folder where you originally installed Python. In my case, the Python application path is:

    C:\Users\Admin\AppData\Local\Programs\Python\Python38

  3. Then type "cd" followed by this path and press enter:

 cd C:\Users\Admin\AppData\Local\Programs\Python\Python38
  1. You should get the following result
 C:\Users\Admin\AppData\Local\Programs\Python\Python38>
  1. Write your python command now and press enter, for example:
 C:\Users\Admin\AppData\Local\Programs\Python\Python38>python -m pip install -U PySide
2

This work for me, Download pip by modifying the Python Installation.

Step 1 - Open Apps & Features
Step 2 - Find Python and click on it
Step 3 - Press Modify
Step 4 - Select pip
Step 5 - Select Add Python to environment variables and install everything

This will install pip and add both, Python and pip to your environment variables.

pradeexsu
  • 1,029
  • 1
  • 10
  • 27
Gaurav
  • 29
  • 2
2

Delete/uninstall, the old version of Python then, go to the path of the new version - C:\Users\Administrator\AppData\Local\Programs\Python\Python310 (Basically when you install python this is the default path)

  1. Copy the above path.
  2. Go to This pc advance system setting , go to environment variables , click on path ,click on new then paste the above path.
  3. C:\Users\Administrator\AppData\Local\Programs\Python\Python310\Scripts add this path too and then ok.
S.B
  • 13,077
  • 10
  • 22
  • 49
Vinay Badola
  • 119
  • 1
  • 5
1

After installing Python 3.10.4 a while ago I was unable to use pip due to the same error message. It seems like that something had gone wrong while installing Python or I had forgotten to add Python to Windows PATH. Long story short:

  • I uninstalled python choosing 'Uninstall' option as shown below. enter image description here

  • I reinstalled Python 3.10 using the same .exe installer.

  • I made sure I had selected the option "Add python to PATH". You will probably find it at the bottom of the installation windows after clicking "Install Python".

Pip worked perfectly fine after this.

Vaggelis Manousakis
  • 292
  • 1
  • 5
  • 15
0

In case the first solution didn't work, give attention to your path, there is a slight chance instead of writing :

C:\Users\\AppData\Local\Programs\Python\Python38-32

you wrote

C:/Users/a610580/AppData/Local/Programs/Python/Python38-32

if you couldn't execute pip install selenium on visual studio write it on cmd first the close and open your visual studio.

0

on windows:

1- make sure where is your python are installed , you can get the current path of python by using the following :

python -c "import os, sys; print(os.path.dirname(sys.executable))"

or

python3 -c "import os, sys; print(os.path.dirname(sys.executable))"

output (for example):

C:\Users\user\AppData\Local\Programs\Python\Python39

now go to that path and access the "Scripts" folder , and check if "pip.exe" or "pip3.exe" are there , if not try to use the following command to fix it and install it by cmd:

python -m ensurepip --upgrade

or

python3 -m ensurepip --upgrade

check again , if "pip.exe" or "pip3.exe" are there, if yes go to next step , if not try to reinstall python again (and click on pip checkbox in your Installation Wizard ) .

2- go to your "environment variables" ==> "system variables" and then click on "path" and add tow paths (as you extract it above) :

C:\Users\user\AppData\Local\Programs\Python\Python39
C:\Users\user\AppData\Local\Programs\Python\Python39\Scripts

3- go to your "environment variables" ==> "user variables for 'your username' " and then click on "path" and add tow paths (as you extract it above) :

C:\Users\user\AppData\Local\Programs\Python\Python39
C:\Users\user\AppData\Local\Programs\Python\Python39\Scripts

4- close and reopen your CMD again and try to type "pip or pip3"

5- if every thing fine try to upgrade your pip version by the following command:

 python -m pip install --upgrade pip

or

 python -m pip install --upgrade pip --user

done.

i hope this helpful .

K.A
  • 1,399
  • 12
  • 24
0

if you have already set the path correctly and still getting the same error then just follow this:

  1. open your vs code and create a new project and copy all the code from this link -https://bootstrap.pypa.io/get-pip.py
  2. Name this project as get-pip.py and run the code in vs code.
  3. pip will get downloaded at the location where you create have set the path for saved projects of your vs code
  4. Copy get-pip.py into your main python folder.
  5. You are good to go.
PRV
  • 13
  • 3
-1

simply go to python root folder like \python38-32 and then go into \Scripts subfolder where contains pip.exe. You can install flawlessly from there. However, to avoid another time recursively go through many files, you should reset the PATH variable as the above answer mentioned.

logbasex
  • 1,688
  • 1
  • 16
  • 22