location of home made modules

William Park parkw at better.net
Mon May 15 18:13:51 EDT 2000


On Mon, May 15, 2000 at 10:01:28PM +0000, Huaiyu Zhu wrote:
> What is the standard place to put one's home-made modules?
> How to get Python to know that place?  I tried to put modules in
> ~/lib/python/ with the following in ~/.pythonrc 
> 
> import sys, os
> sys.path.append("%s/lib/python" % os.environ["HOME"])
> 
> This works in the interactive interpreter but does not get the module from
> program files.  Previously all my modules stay in the same directory as the
> programs that load them so this problem did not manifest itself.
> 
> 
> I can't find where in the docs this is mentioned.
> Thanks for any pointer.
> 
> -- 
> Huaiyu Zhu                               hzhu at knowledgetrack.com

Use environment variable
    PYTHONPATH=~/lib/python
or put the module in 
    /usr/local/lib/site-python/...

Python online doc explain this.  Search for 'PYTHONPATH' or
'site-packages' or 'site-python'.

--William




More information about the Python-list mailing list