Reputation: 21261
On WinXP sp2 I'd like to have a directory of modules that other python scripts will be using called "SharedPython" in the same directory as my python scripts. so, basically:
/pythonScripts
/pythonScripts/SharedPython
as well as other python scripts on the same level as the SharedPython directory.
when I run
print sys.path
I get the following output:
C:\WINDOWS\system32\python25.zip
C:\Python25\DLLs
C:\Python25\lib
C:\Python25\lib\plat-win
C:\Python25\lib\lib-tk
C:\Python25
C:\Python25\lib\site-packages
I don't know what environment variable controls this and, in fact, I don't see one that contains all these directories. So, a.)how do I determine which environment variable contains this list of dirs? and b.)can I just add the aforementioned SharedPython dir to that list?
I've tried setting PYTHONPATH to the following: %PYTHONPATH%C:\PythonScripts\SharedPython
Upvotes: 1
Views: 2760
Reputation: 273366
You need the PYTHONPATH
env var. The dirs listed in it are prepended to sys.path
.
The correct way to setup PYTHONPATH
in your case is:
set PYTHONPATH=%PYTHONPATH%;C:\PythonScripts\SharedPython
Note the semicolon between the second %
and the C:\
Upvotes: 5
Reputation: 798456
Those paths are added by the site
module; do not change this module, but rather create a batch file that adds your paths in %PYTHONPATH%
and then runs the script.
Upvotes: 1