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:
Use
set Path = `%PATH%;C:\Python34\;C:\Python27\Scripts`
Source
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:\Python27\Scripts
. 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:\Python27\Scripts", "User")
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.
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.
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
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 ..