Reputation: 10241
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:\python34\lib\site-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> lib\site-packages\pip install Django
'lib\site-packages\pip' 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 Files\ImageMagick-6.8.8-Q16;C:\Program Files (x86)\Intel\iCLS Client\
;C:\Program Files\Intel\iCLS Client\;C:\Windows\system32;C:\Windows;C:\Windows\S
ystem32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\
Windows Live\Shared;C:\Program Files (x86)\Intel\OpenCL SDK\2.0\bin\x86;C:\Progr
am Files (x86)\Intel\OpenCL SDK\2.0\bin\x64;C:\Program Files\Intel\Intel(R) Mana
gement Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine C
omponents\IPT;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components
\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;C:\P
rogram Files (x86)\nodejs\;C:\Program Files (x86)\Heroku\bin;C:\Program Files (x
86)\git\cmd;C:\RailsInstaller\Ruby2.0.0\bin;C:\RailsInstaller\Git\cmd;C:\RailsIn
staller\Ruby1.9.3\bin;C:\Users\Javi\AppData\Roaming\npm
Upvotes: 602
Views: 3226310
Reputation: 1272
Another tips, check ur anti virus... in my case, that thing remove all files inside "Scripts" folder on my Python folder.... so the pip and ENV can find it.
Upvotes: 0
Reputation: 343
Simply Changing pip install xxx to pip3 install xxx did the job.
Note:
echo %PATH%
in command prompt. For me it printed "C:\Users\admin\AppData\Local\Programs\Python\Python312\Scripts" as one of the set pathsUpvotes: 1
Reputation: 53
try this: Before taking any drastic measures, it's a good idea to check your current Python installation:
Open a terminal or command prompt.
Run the command python --version or python3 --version
to check your Python version. Note it down.
Now, try running python -m ensurepip --default-pip
(or use python3 instead of python if that's your primary command). This command will attempt to bootstrap the installation of pip if it's missing.
Upvotes: 0
Reputation: 604
I tried all these methods and watched so many YouTube videos regarding this and nothing work for me.
Finally I tried this way and it worked.
In my case only the Pip was only not identified.
Go to this site. https://bootstrap.pypa.io/get-pip.py
Download that file by right clicking on that page. Create a new folder and put that file in to that folder. Navigate to that folder and open cmd inside that folder. Then type.
python get-pip.py
After that, it will start to download. Like this in SS.
After successfully installed, close cmd and run again the cmd and type
pip --version
then in my case of course it shows like this
it worked. Most of these solutions related to setting the path in environmental variable . But my case in script folder there wasn't any file to be seen. I think the most easiest way is uninstall python through setup and delete other pip things then create new pip installation. if it isn't working the path setting to the environment variable refer this YouTube video. (Copied from Youtube)
Upvotes: 6
Reputation: 1149
Windows: the only solution that worked for me is:
Navigate to C:\Users\username\AppData\Local\Programs\Python\Python310\Scripts
Copy the path
Open Environment Variables → System Variables
Paste
After that, PIP should work correctly!
Upvotes: 7
Reputation: 682
'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;
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.
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;
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:\Python310\Scripts
. You can check this path yourself like this;
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:\Python310\Scripts
.
Go to Start* → This PC → Properties → Advanced System Settings → Advanced → Environment Variables
As shown in the image above, select Path, click the Edit button and add the copied path. Restart the CMD and test pip command again.
If pip is not installed, you can install it again by downloading latest python.exe
setup from the python.org website. Make sure you check mark the pip option as shown in the image below.
In the next step, check mark "Add Python to environment variables"
Upvotes: 6
Reputation: 169
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.
open the Python installation directory
pip in c:\python34\lib\site-packages\
We suppose that you have installed Python on the C: drive in the 'python34' named folder. This will be definitely different for you.
Under the 'site-packages' folder, find the pip folder. If it is, then all is set. You just need to go for the 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.
Open the Python installation directory:
Here copy the path of the installation directory. For example:
C:\python38;
C:\python38\Scripts;
Here I am assuming that python is installed under the 'C:\python38' directory. Please change accordingly.
Now in Windows, click on the start button and search:
Environment Variable
Open edit the "System Environment Variables" option.
Under User Variables, choose Path and open it by clicking.
Now click on Add new and just add the above copied path one by one.
Save it and close all tabs.
Open cmd and type
pip -V
pip -V
pip 20.2.3 from c:\python38\lib\site-packages\pip (python 3.8)
Now it works.
Upvotes: 0
Reputation: 2077
The only way that worked on my Windows 10 machine was as follows:
py -3 -m pip install xxxxx
Upvotes: 58
Reputation: 483
When installing SQL Server 2019 Python, there are known issues for PIP which require a fix (step 7). See Known issues for Python and R in SQL Server Machine Learning Services.
'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 Files\Microsoft SQL Server\MSSSQL15.MSSQLSERVER\PYTHON_SERVICES\Library\bin
to the folder
C:\Program Files\Microsoft SQL Server\MSSSQL15.MSSQLSERVER\PYTHON_SERVICES\DLLs
Then open a new DOS command shell prompt.
Upvotes: 0
Reputation: 3539
For Windows users:
Open your Python's scripts folder; it's usually located in this path:
C:\Users\<USER>\AppData\Local\Programs\Python\Python<VERSION>\Scripts
,
for example: C:\Users\elyas\AppData\Local\Programs\Python\Python311\Scripts
.
Then, see if there is a pip executable file, if you don't see one, run this CMD command: python -m ensurepip --upgrade
If you do see a pip executable file, look at it's name, and run it in CMD. For example, I have a pip3.exe file, so in CMD I run pip3
. If the command is not recognized, then make sure the scripts folder is in the system's PATH variables:
rundll32.exe sysdm.cpl,EditEnvironmentVariables
Upvotes: 2
Reputation: 4991
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
Upvotes: 2
Reputation: 2952
As of now, version 3.7.3 I had a little bit of an issue with getting the right system variable.
Try this:
Type start %appdata%
in cmd.
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.
Once you do that click the start icon and navigate to the Control Panel → System and Security → System. 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:
Click OK three times, open a new window of cmd and type: pip
. See if it works.
Upvotes: 255
Reputation: 375
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:\Users\username\AppData\Local\Programs\Python38
Upvotes: 2
Reputation: 1496
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...
Upvotes: 3
Reputation: 1003
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
Upvotes: 4
Reputation: 6788
For Mac, run the below command in a terminal window:
echo export "PATH=$HOME/Library/Python/2.7/bin:$PATH"
Upvotes: 0
Reputation: 749
I was facing the same issue. Run Windows PowerShell as Administrator. It resolved my issue.
Upvotes: 3
Reputation: 17
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:\Users\devel\AppData\Local\Programs\Python\Python36\Lib requests <br>
PS: If you want to check if it's installed,
<Library-Name> --version
will not work correctly.
Upvotes: -5
Reputation: 156
For me the issue was the system was not restarted after adding the below in PATH:
C:\Users\admin\AppData\Local\Programs\Python\Python37\Scripts
Upvotes: 0
Reputation: 458
In a Windows environment, just execute the below commands in a DOS shell.
path=%path%;D:\Program Files\python3.6.4\Scripts; (new path=current path;path of the Python script folder)
Upvotes: 2
Reputation: 19196
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.
Upvotes: 0
Reputation: 1
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.
Upvotes: 0
Reputation: 490
Or if you are using PyCharm (2017-03-03) like me, just change directory in terminal and install:
cd C:\Users\{user}\PycharmProjects\test\venv\Scripts
pip install ..
Upvotes: 5
Reputation: 28257
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
Upvotes: 4
Reputation: 458
I have just installed Python 3.6.2.
I got the path as
C:\Users\USERNAME\AppData\Local\Programs\Python\Python36-32\Scripts
Upvotes: 4
Reputation: 6016
In latest version Python 3.6.2 and above, is available in
C:\Program Files (x86)\Python36-32\Scripts
You can add the path to our environment variable path as below
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.
Upvotes: 10
Reputation: 3517
For Windows, when you install a package, you type:
python -m pip install [packagename]
Upvotes: 350
Reputation: 345
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.)
Upvotes: 0
Reputation: 149
Try going to Windows PowerShell or cmd prompt and typing:
python -m pip install openpyxl
Upvotes: 14