pythonpath

Dave Angel davea at ieee.org
Sun Nov 22 02:58:14 CET 2009


Ray Holt wrote:
> Is there a way to make python point to a different directory for modules. I
> don't like to keep my modules in the program directory, but I can't figure
> out from the shell how to get the program to look in another directory. I am
> using XP Pro as an operating system and python2.6
>
>   
There are a few standard places that Python already looks for module 
imports.  To see what they are on your system, you could simply look at 
sys.path.

import sys
for path in sys.path:
     print path

In particular, you probably want to use the directory under appdata:

C:\Documents and Settings\XXXX\Application 
Data\Python\Python26\site-packages


where XXXX is your user-name.

DaveA




More information about the Python-list mailing list