saving local dir

Peter Hansen peter at engcorp.com
Fri Oct 29 09:38:23 EDT 2004


Bengt dePaulis wrote:
> I just started on python.
> 
> I have c:\python23\examples\py
> and want to include that in my sys.path
> 
> How to do it permanently?

In addition to Tim's suggestion, you can also use
".pth" files, as documented primarily in the comments
at the top of c:\python23\lib\site.py.

I find this a cleaner approach than PYTHONPATH,
though the latter might be better for one-shot
situations where you want to affect only one console
window and all future ones.

(In a nutshell, create a file called somename.pth,
being careful to use a *lowercase* .pth instead of .PTH,
and stick it in c:\python23.  Put the paths that
you want in sys.path into that file, one per line,
such as "c:\python23\examples" without the quotes...)

-Peter



More information about the Python-list mailing list