To add an environment variable for Python, like you want to set the directory where all your python scripts will be stored to be added directly at runtime, you need to set the environment variable. For that, follow the steps:-
1. Goto myComputer and right click onto that. Goto System Properties.
Now in properties, goto Advanced System Properties and in that dialog, select Advanced. Click on Environment Variables provided there.
In the system Variable Section, select New and then specify as:-
Variable Name: PYTHONPATH
Variable Value: <Path of your scripts folder where you store your scripts>
Click ok. Now close and restart the Python Shell. It will get that environment Variable.
You can check by typing the following commands:-
>>>import sys
>>>sys.path
It should contain the path of your directory which is set.
No comments:
Post a Comment