Setting windows environment variables for python:
Typically python will install itself in:
C:\users\<user-name>\appdata\local\programs\python<version>\
Win 7: CONTROL PANEL > SYSTEM > ADVANCED SYSTEM SETTINGS >
ENVIRONMENT VARIABLES
Win 10; This PC > Properties > Advanced System Settings > Environment Variables
then add a new system variable.
For example PYTHONPATH=C:\pycode\utilities
(c:\pycode\utilities could really be anything you stick your code and libraries in, but because python install on appData, you can put in
C:\Users\<user-name>\AppData\Local\Programs\Python\Python38-32\ )
next you will set the Path system variable:
go to system variable and EDIT
Now add the PATH you set in the first step, using % at start and end:
in the 'edit environment variable' add NEW, i called my previous environment variable PYTHONPATH, so that will go in:
now you can verify, by opening a command prompt and, typing 'python:
which should now allow you to run python from any directory without having to go to the directory where python is installed
In python IDLE this directory should now show up in your path browse.
No comments:
Post a Comment