Reputation: 95
I'm on a new computer, and have to install Django again, so I typed the pip install Django
command in my VSCode terminal to install it. However, after it downloads, I get this message:
WARNING: The script django-admin.exe is installed in 'C:\Users\Xiaow\AppData\Roaming\Python\Python39\Scripts' which is not on PATH.
Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
Because of this, I can't start any new projects. How would I install this script to PATH? Is there a command I have to do or something?
There also seems to be a .vscode folder in 'C:\Users\Xiaow' but I don't know if this is what is making Django not install the admin script to PATH.
Everything else works, like I can go to my existing projects (copied over from my old computer) and runserver, and can access all the databases. However, it's just this admin script that is causing problems. I also tried uninstalling and reinstalling Django to no avail.
Full terminal message:
PS C:\Code> pip install Django
Defaulting to user installation because normal site-packages is not writeable
Collecting Django
Using cached Django-3.1.4-py3-none-any.whl (7.8 MB)
Requirement already satisfied: pytz in c:\users\xiaow\appdata\roaming\python\python39\site-packages (from Django) (2020.4)
Requirement already satisfied: sqlparse>=0.2.2 in c:\users\xiaow\appdata\roaming\python\python39\site-packages (from Django) (0.4.1)
Requirement already satisfied: asgiref<4,>=3.2.10 in c:\users\xiaow\appdata\roaming\python\python39\site-packages (from Django) (3.3.1)
Installing collected packages: Django
WARNING: The script django-admin.exe is installed in 'C:\Users\Xiaow\AppData\Roaming\Python\Python39\Scripts' which is not on PATH.
Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
Successfully installed Django-3.1.4
Upvotes: 1
Views: 14270
Reputation: 31
I'm pretty sure that you need to add the path from the script to your list of environment variables... You can do so by running a command.
Try running this in the windows command prompt:
set PATH=%PATH%;C:\Users\Xiaow\AppData\Roaming\Python\Python39\Scripts
Also, here is the source of the command listed above: Adding a directory to the PATH environment variable in Windows
UPDATE:
Just learned that the set
command only sets the variable for the current session, so if you want the change to stay permanent then go ahead and use setx
instead.
Upvotes: 3