'pip' is not recognized as an internal or external command

Question:

I’m running into a weird error when trying to install Django on my computer.

This is the sequence that I typed into my command line:

C:Python34> python get-pip.py
Requirement already up-to-date: pip in c:python34libsite-packages
Cleaning up...

C:Python34> pip install Django
'pip' is not recognized as an internal or external command,
operable program or batch file.

C:Python34> libsite-packagespip install Django
'libsite-packagespip' is not recognized as an internal or external command,
operable program or batch file.

What could be causing this?

This is what I get when I type in echo %PATH%:

C:Python34>echo %PATH%
C:Program FilesImageMagick-6.8.8-Q16;C:Program Files (x86)InteliCLS Client
;C:Program FilesInteliCLS Client;C:Windowssystem32;C:Windows;C:WindowsS
ystem32Wbem;C:WindowsSystem32WindowsPowerShellv1.0;C:Program Files (x86)
Windows LiveShared;C:Program Files (x86)IntelOpenCL SDK2.0binx86;C:Progr
am Files (x86)IntelOpenCL SDK2.0binx64;C:Program FilesIntelIntel(R) Mana
gement Engine ComponentsDAL;C:Program FilesIntelIntel(R) Management Engine C
omponentsIPT;C:Program Files (x86)IntelIntel(R) Management Engine Components
DAL;C:Program Files (x86)IntelIntel(R) Management Engine ComponentsIPT;C:P
rogram Files (x86)nodejs;C:Program Files (x86)Herokubin;C:Program Files (x
86)gitcmd;C:RailsInstallerRuby2.0.0bin;C:RailsInstallerGitcmd;C:RailsIn
stallerRuby1.9.3bin;C:UsersJaviAppDataRoamingnpm
Asked By: user3597950

||

Answers:

You need to add the path of your pip installation to your PATH system variable. By default, pip is installed to C:Python34Scriptspip (pip now comes bundled with new versions of python), so the path “C:Python34Scripts” needs to be added to your PATH variable.

To check if it is already in your PATH variable, type echo %PATH% at the CMD prompt

To add the path of your pip installation to your PATH variable, you can use the Control Panel or the setx command. For example:

setx PATH "%PATH%;C:Python34Scripts"

Note:
According to the official documentation, “[v]ariables set with setx variables are available in future command windows only, not in the current command window”. In particular, you will need to start a new cmd.exe instance after entering the above command in order to utilize the new environment variable.

Thanks to Scott Bartell for pointing this out.

Answered By: fr1tz

For me the command:

set PATH=%PATH%;C:Python34Scripts

worked immediately (try after echo %PATH% and you will see that your path has the value C:Python34Scripts).

Thanks to: Adding a directory to the PATH environment variable in Windows

Answered By: zygimantus

Even I’m new to this, but pip install django worked for me.

The path should be set as where the script folder of the Python installation is, i.e.C:Python34Scripts.

I suppose it’s because Django is a framework which is based on Python, and that’s why this directory structure has to be maintained while installing.

Answered By: Sumit Nautiyal

I think from Python 2.7.9 and higher pip comes pre installed and it will be in your scripts folder.

So you have to add the "scripts" folder to the path. Mine is installed in C:Python27Scripts. Check yours to see what your path is so that you can alter the below accordingly. Then go to PowerShell, paste the below code in PowerShell and hit Enter key. After that, reboot and your issue will be resolved.

[Environment]::SetEnvironmentVariable("Path", "$env:Path;C:Python27Scripts", "User")
Answered By: poodytang

I was having the same problem just now.

After adding the proper folder (C:Python33Scripts) to the path, I still could not get pip to run. All it took was running
pip.exe install -package- instead of
pip install -package-.

Answered By: Josh

Small clarification: in “Windows 7 64 bit PC”, after adding ...Python34Scripts to the path variable, pip install pygame didn’t work for me.

So I checked the “…Python34Scripts” folder, it didn’t have pip, but it had pip3 and pip3.4. So I ran pip3.4 install pygame .... .whl. It worked.

(Further open a command window in the same folder where you have the downloaded pygame...whl file.)

Answered By: kosa

Use

set Path = `%PATH%;C:Python34;C:Python27Scripts`

Source

Answered By: sajjad

Also, the long method – it was a last resort after trying all previous answers:

C:python27scriptspip.exe install [package].whl

This after cd in directory where the wheel is located.

Answered By: Colin Miles

Try going to Windows PowerShell or cmd prompt and typing:

python -m pip install openpyxl
Answered By: natty

I continued to receive this error after correcting my PATH.

If your codebase requires that you have an earlier version of Python (2.7 in my case), it may have been a version prior to the existence of pip.

It’s not very canonical, but installing a more recent version worked for me. (I used 2.7.13.)

Answered By: Womble

I had this same issue. You just need to go to your

C:Python27Scripts

and add it to environment variables. After path setting just run pip.exe file on C:Python27Scripts and then try pip in cmd. But if nothing happens try running all pip applications like pip2.7 and pip2.exe. And pip will work like a charm.

Answered By: shivam gupta

For Windows, when you install a package, you type:

python -m pip install [packagename]
Answered By: Yijing Shi

As per Python 3.6 Documentation

It is possible that pip does not get installed by default. One
potential fix is:

python -m ensurepip --default-pip
Answered By: Jeferson Andrade

In latest version Python 3.6.2 and above, is available in

C:Program Files (x86)Python36-32Scripts

You can add the path to our environment variable path as below

Enter image description here

Make sure you close your command prompt or Git after setting up your path. Also should you open your command prompt in administrator mode. This is example for Windows 10.

Answered By: Karthikeyan VK

I have just installed Python 3.6.2.

I got the path as

C:UsersUSERNAMEAppDataLocalProgramsPythonPython36-32Scripts

Answered By: sanjeev shetty

In Windows, open cmd and find the location of PYTHON_HOME using where python. Now add this location to your environment variable PATH using:

set PATH=%PATH%;<PYTHON_HOME>Scripts

Or refer to this.


In Linux, open a terminal and find the location of PYTHON_HOME using which python. Now add the PYTHON_HOME/Scripts to the PATH variable using:

PATH=$PATH:<PYTHON_HOME>Scripts
export PATH
Answered By: Ani Menon

Go to control Panel >> Uninstall or change Program and double click on Python XXX to modify install. Make sure PIP component is checked and install.

enter image description here

Answered By: Manjoo

You can try pip3. Something like:

pip3 install pandas
Answered By: Ankit Chakraborty

Alternate way.

If you don’t want to add the PATH as the previous well written answers pointed out,

but you want to execute pip as your command then you can do that with py -m as prefix.

Given that you have to do it again and again.

eg.

py -m <command>

as in

py -m pip install --upgrade pip setuptools

Also make sure to have pip and py installed

enter image description here

Answered By: faruk13

Or if you are using PyCharm (2017-03-03) like me, just change directory in terminal and install:

cd C:Users{user}PycharmProjectstestvenvScripts
pip install ..
Answered By: Fappie.

A very simple way to get around this is to open the path where pip is installed in File Explorer, and click on the path, then type cmd, this sets the path, allowing you to install way easier.

I ran into the same issue a couple days ago and all the other methods didn’t work for me.

Answered By: Finlay Scutt

Try to uninstall Python, delete the remaining program files, and then install it again fresh.

It worked for me. This error happened to me when I migrated to a new laptop and used a migration software to move my software from the old laptop to the new one. And yeah, it didn’t work quite well.

Answered By: Aminah Nuraini

Control Panel -> add/remove programs -> Python -> Modify -> optional Features (you can click everything) then press next -> Check “Add python to environment variables” -> Install

enter image description here

And that should solve your path issues, so jump to command prompt and you can use pip now.

Answered By: Gus

In a Windows environment, just execute the below commands in a DOS shell.

path=%path%;D:Program Filespython3.6.4Scripts;
(new path=current path;path of the Python script folder)

Answered By: Baiju Chandran

For me the issue was the system was not restarted after adding the below in PATH:

C:UsersadminAppDataLocalProgramsPythonPython37Scripts
Answered By: Noman Ibrahim

As of now, version 3.7.3 I had a little bit of an issue with getting the right system variable.

Try this:

  1. Type start %appdata% in cmd.

  2. After that file explorer should pop up in ../AppData/Roaming.

Go back one directory and navigate to Local/Programs/Python/Python37-32/Scripts.

NOTE: The version number may be different so if you copy and paste the above file path it could not work.

After you do this you now have the correct location of your downloaded Python. Copy your file path by selecting the whole directory in the address bar.

Enter image description here

Once you do that click the start icon and navigate to the Control PanelSystem and SecuritySystem. Then click "Advanced System Settings" on the left side of the panel.

Once there, click Environment Variables on the bottom right and there will be two boxes, an upper and a lower box. In the upper box: Click on the ‘Path’ Variable and click Edit located on the right. Click New and paste your directory Path. It should look something like this:

Enter image description here

Click OK three times, open a new window of cmd and type: pip. See if it works.

Answered By: Thomas

If you are working with Python, e.g. PyCharm, you should install the library to the Python library path like this:

pip install --target=C:Users<...>lib <Library-Name>

real e.g.

pip install --target=C:UsersdevelAppDataLocalProgramsPythonPython36Lib requests <br>

PS: If you want to check if it’s installed,

<Library-Name> --version

will not work correctly.

Answered By: safe89

I was facing the same issue. Run Windows PowerShell as Administrator. It resolved my issue.

Enter image description here

Answered By: Kamran

Most frequently it is:

in cmd.exe write

python -m pip install --user [name of your module here without brackets]
Answered By: Kokokoko

When installing SQL 2019 Python, there are known issues for PIP which require a fix (step 7)
https://docs.microsoft.com/en-us/sql/advanced-analytics/known-issues-for-sql-server-machine-learning-services?view=sql-server-ver15

pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.

Workaround
Copy the following files:

libssl-1_1-x64.dll
libcrypto-1_1-x64.dll

from the folder 
C:Program FilesMicrosoft SQL ServerMSSSQL15.MSSQLSERVERPYTHON_SERVICESLibrarybin
to the folder 
C:Program FilesMicrosoft SQL ServerMSSSQL15.MSSQLSERVERPYTHON_SERVICESDLLs

Then open a new DOS command shell prompt.
Answered By: Jamie

For Mac, run the below command in a terminal window:

echo  export "PATH=$HOME/Library/Python/2.7/bin:$PATH"
Answered By: Lijo

The only way that worked on my Windows 10 machine was as follows:

py -3 -m pip install xxxxx
Answered By: HassanSh__3571619

None of these actually worked for me, but running

python -m pip install -U pip

and then adding the specified directory to the PATH as suggested got it working

In your Python folder path in Terminal, just type

  py -m pip

in order to check the current version of your pip.
You will also see a list of commands, you can use…

enter image description here

Answered By: MKR

So this error can we resolved very easily .

First of all you have to check if the pip is installed or not with python .
For That you need to follow following method.

  1. open the python installation directory

    pip in c:python34libsite-packages

we supposes that you have installed python in c drive in python34 named folder.
this will be definitely different for you .

  1. Under site-packages folder find pip folder . If it is, then all set, you just need to go for next step .
    If not Just refer to this tutorial to install it

Now Pip is installed in our system and you just need to configure it.

  1. Open the Python installation directory:

Here copy the path of installation directory
ex :

C:python38;
C:python38Scripts;

Here i am assuming that python is installed under C:python38 directory. Please change accordingly.

  1. Now In windows Click on start Button and search :

    Environment Variable

3.Open edit the system environment Variable option.

  1. Under User variable choose Path and open it by clicking .

  2. Now click on add new and just add above copied path one by one .

  3. save it and close all tabs .

  4. Open cmd and type

    pip -V

    PS C:Userspro> pip -V
    pip 20.2.3 from c:python38libsite-packagespip (python 3.8)
    

Now Its Work.

Having Issue Let me know.

Answered By: Utkarsh verma

I deleted the older version using the control panel and then installed the new version however the newer version was not reflecting pip even after adding the right paths in the environment variables. However, the thing that worked for me was deleting the folders of old python that were there in the local App folder even after uninstall. For me, the path was like below. Deleting this folder solved my issue

C:UsersusernameAppDataLocalProgramsPython38
Answered By: Ali Mohsan

For Python 2.7:
Just use this command in Command Prompt [Run as administrator]:

mklink /H pip.exe c:python27Scriptspip.exe

Result:
Hardlink created for pip.exe <<===>> c:python27Scriptspip.exe

And…done 🙂

Answered By: Nishant Bhagat

First of all, check the pip version, and its existence on machine

 pip --version

or

 pip3 --version

If you in case pip is not installed then install it.

On Linux, you can install pip3 by running an apt-get command in your terminal.

sudo apt-get -y install python3-pip

On Mac, pip is bundled with the Python distributable, so you need to re-install Python

brew uninstall --ignore-dependencies python3 && brew install python3

On window this issue occurs when pip is not correct in the PATH file

You can try below py prefix alternative to make it work

python -m pip install [packagename]

To set pip PATH [Reffer to Ani Menon Answer for details]

Find the location of PYTHON_HOME using

where python

Now add this location to your environment variable PATH using

set PATH=%PATH%;<PYTHON_HOME>Scripts

Or

On Linux, open a terminal and find the location of PYTHON_HOME using

which python

Now add the PYTHON_HOME/Scripts to the PATH variable using:

PATH=$PATH:<PYTHON_HOME>Scripts
export PATH
Answered By: Umar Hayat

'pip' is not recognized as an internal or external command

pip is a python module used to install packages. For your problem, there can be many reasons;

  • Restart CMD/Terminal
  • Environment variable is not set. pip is installed but environment variable is not set. Environment variable is a windows variable where pip path is saved, so it can be run at run time.
  • pip is not installed.

Restart CMD/Terminal

It is sometimes possible that you opened your command prompt or terminal before installing pip and now it just needs a restart to pick up the latest environment variables. It is worth trying just restarting your command prompt or terminal.

Environment Variable is Not Set

Open CMD and run this command to see the values set in the PATH environment variable.

echo %PATH%

This will echo the PATH environment variable like this;
enter image description here

You should check if your path exist in the echoed PATH list. For example, in my case, the path for pip.exe files is C:Python310Scripts. You can check this path yourself like this;
enter image description here

If you can find pip path and it does not exist the echoed PATH variable, then we need to add it. Copy the path like C:Python310Scripts.

Go to Start > This PC > Properties > Advance system settings >
Advanced > Environment Variables

enter image description here

As shown in the image above, Select Path, click Edit button and add the copied path. Restart the CMD and test pip command again.

pip is Not Installed

If pip is not installed, you can install it again by downloading latest python.exe setup from python.org website. Make sure you check mark the pip option as shown in the image below.
enter image description here

In the next step, check mark "Add Python to environment variables"
enter image description here

Answered By: Umair Anwar
Categories: questions Tags: , , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.