One of the most common problems with running Python tools like pip is the “not on PATH” error. This means that Python cannot find the tool you're trying to run in your current directory. In most cases, you'll need to navigate to the directory in which the tool is installed before you can run the command to launch it.
The error “'pip' is not recognized as an internal or external command” is encountered because of two main reasons that are. PIP Installation path is not added to the system variables: If you have installed python through prompt then you need to configure PIP path manually.
instead of typing in "python". try using "py". for ex:
py -m pip install packagename
py -m pip --install packagename
py -m pip --upgrade packagename
py -m pip upgrade packagename
note: this should be done in the command prompt "cmd" and not in python idle. also FYI pip is installed with python 3.6 automatically.
Make sure the path to scripts folder for the python version is added to the path environment/system variable in order to use pip command directly without the whole path to pip.exe which is inside the scripts folder.
The scripts folder would be inside the python folder for the version that you are using, which by default would be inside c drive or in c:/program files or c:/program files (x86).
Then use commands as mentioned below. You may have to run cmd as administrator to perform these tasks. You can do it by right clicking on cmd icon and selecting run as administrator
.
python -m pip install packagename
python -m pip uninstall packagename
python -m pip install --upgrade packagename
In case you have more than one version of python. You may replace python
with py -versionnumber
for example py -2
for python 2 or you may replace it with the path to the corresponding python.exe file. For example "c:\python27\python"
.
You installed Python and added it to PATH. You've checked it too(like 64-bit etc). Everything should work but it is not.
what you didn't do is a
terminal/cmd restart
restart your terminal and everything would work like a charm.
I Hope, it helped/might help others.
You should use python and pip in terminal or powershell terminal not in IDLE.
Examples:
pip install psycopg2
or
python -m pip install psycop2
Remember about add python to Windows PATH. I paste examples for Win7. I believe in Win10 this is similar.
Adding Python Path on Windows 7
python 2.7: cannot pip on windows "bash: pip: command not found"
Good luck:)
I faced a problem upgrading pip from version 9.0.1 to 9.0.3 The upgrade failed middle way(after uninstalling version 9.0.1 and without installing version 9.0.3). This usually creates a broken pip file. Broken pip can be solved by the command-->
easy_install pip
Which usually installs the latest version of pip, and solves the issue. In order to confirm, type
pip --version
Hope this was helpfull...
According to pip documentation
pip is already installed if you are using Python 2 >=2.7.9 or Python 3 >=3.4 downloaded from python.org
But I was surprised when I typed pip --version
in the Python Launcher and it gave me an error saying that 'pip' is not recognized. Then I tried the same in Python IDLE which gave the same error. Then I opened a cmd and typed python pip --version
and it said something like "can't open file".
Solution:
I finally realized that pip
commands are properly recognized outside of the python.exe, because pip is a separate executable. So, just open a cmd and type pip --version
and it should work as expected. If you call pip
inside a Python executable (such as the Launcher, IDLE, or calling python pip
), it assumes pip is just a variable and complains that it is not defined.
Note: I made sure that C:\Users\<username>\AppData\Local\Programs\Python\<Python version>\
and C:\Users\<username>\AppData\Local\Programs\Python\<Python version>\Scripts\
are included in the PATH
variable.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With