安装Django时pip升级后出现脚本路径不在PATH中的警告问题
Hey there! Let’s sort out those annoying PATH warnings you got after installing Django. Here’s a breakdown of what’s happening and how to fix it for good:
What’s the Issue?
The warnings are telling you that the scripts sqlformat.exe and django-admin.exe were installed in C:\Users\Easwar Sai Prasad\AppData\Roaming\Python\Python38\Scripts, but this directory isn’t listed in your system’s PATH environment variable.
Why does this matter? Because when you try to run commands like django-admin from your terminal or CMD, your system doesn’t know where to find these scripts—so you’ll get a "command not found" error unless you specify the full file path every time.
Solution 1: Add the Directory to PATH (Recommended)
This is the permanent fix that lets you run django-admin and sqlformat from anywhere in your terminal. Here’s how to do it on Windows:
- Right-click This PC (or My Computer) and select Properties.
- Click Advanced system settings on the left sidebar.
- In the pop-up window, go to the Advanced tab and click Environment Variables.
- Under System variables, find the
Pathvariable and click Edit. - Click New and paste the full directory path:
C:\Users\Easwar Sai Prasad\AppData\Roaming\Python\Python38\Scripts - Click OK on all open windows to save the changes.
- Restart your terminal/CMD—this is crucial for the new PATH settings to take effect.
Once done, you can run django-admin --version to verify it works without any warnings!
Solution 2: Suppress the Warning (Temporary Fix)
If you just want to hide the warning for a single installation (but note this doesn’t fix the underlying PATH issue), you can add the --no-warn-script-location flag to your pip install command:
pip install Django --no-warn-script-location
Keep in mind: Even with this, you’ll still need to use the full script path or add the directory to PATH later if you want to run django-admin easily.
内容的提问来源于stack exchange,提问作者Easwar Sai

