How do I add permanently to Pythons sys.path?

Aaron "Castironpi" Brady castironpi at gmail.com
Tue Sep 16 22:35:29 CEST 2008


On Sep 16, 2:40 pm, "Support Desk" <m... at ipglobal.net> wrote:
> What about on a unix box?

Do you have write permissions on, in this case, '/opt/pkgs/python-2.0/
lib/python2.0/site-packages' ?  (Or the entry in your sys.path.)

>>> import sys
>>> sys.path
['', '/opt/pkgs/python-2.0/lib/python2.0', '/opt/pkgs/python-2.0/lib/
python2.0/plat-sunos5', '/opt/pkgs/python-2.0/lib/python2.0/lib-tk', '/
opt/pkgs/python-2.0/lib/python2.0/lib-dynload', '/opt/pkgs/python-2.0/
lib/python2.0/site-packages']



>
> Sincerely,
> Michael H.
>
> -----Original Message-----
> From: Aaron "Castironpi" Brady [mailto:castiro... at gmail.com]
> Sent: Tuesday, September 16, 2008 12:49 PM
> To: python-l... at python.org
> Subject: Re: How do I add permanently to Pythons sys.path?
>
> On Sep 16, 10:13 am, cnb <circularf... at yahoo.se> wrote:
> > >>> sys.path
>
> > ['C:\\Python25\\Progs\\NatLangProc', 'C:\\Python25\\Lib\\idlelib', 'C:\
> > \Windows\\system32\\python25.zip', 'C:\\Python25\\lib\\site-packages\
> > \orange', 'C:\\Python25\\lib\\site-packages\\orange\\OrangeWidgets',
> > 'C:\\Python25\\lib\\site-packages\\orange\\OrangeCanvas', 'C:\
> > \Python25\\DLLs', 'C:\\Python25\\lib', 'C:\\Python25\\lib\\plat-win',
> > 'C:\\Python25\\lib\\lib-tk', 'C:\\Python25', 'C:\\Python25\\lib\\site-
> > packages', 'C:\\Python25\\lib\\site-packages\\Numeric', 'C:\\Python25\
> > \lib\\site-packages\\PIL']
>
> > Now I have my personal programs in C:/Python25/Progs/
>
> > How do I add so that I can just do "import somefile" from anywhere in
> > that directory in the interpreter and it can load files from other
> > folders in that directory.
>
> Add a file: \Lib\site-packages\locals.pth
>
> with contents, path to the directory you want to add (/python25/progs/)
>
>




More information about the Python-list mailing list