When attempting to install Django on a Windows system, you may encounter the perplexing error: "pip is not recognized as an internal or external command." This issue stems from a missing path variable directing the command line to the pip executable.
PATH is an environment variable that contains a list of directories where the command line searches for executable files. If the directory containing pip is absent from this list, the command line will be unable to locate and execute the program.
By default, pip is usually installed in C:Python34Scripts (assuming Python 3.4 is being used). To confirm its location, navigate to the command line and enter:
echo %PATH%
This command will display the current PATH variable. If you do not see C:Python34Scripts in the list, proceed to the next step.
To add the required directory to the PATH environment variable, follow these steps:
Using the Control Panel:
Using the setx command:
Enter the following command:
setx PATH "%PATH%;C:\Python34\Scripts"
Note: You may need to restart the command line or open a new one for the change to take effect.
After updating the PATH variable, pip should now be recognized as a command. You can proceed with the Django installation by rerunning:
pip install Django
Reinstalling pip may be necessary if the error persists.
The above is the detailed content of Why Isn't 'pip' Recognized as a Command in Windows, and How Can I Fix It?. For more information, please follow other related articles on the PHP Chinese website!