Question on Python path
op73418 at mail.telepac.pt
Mon Feb 25 18:20:46 CET 2002
On 25 Feb 2002 17:57:44 +0100, Chris Liechti <cliechti at gmx.net> wrote:
>Gonçalo Rodrigues <op73418 at mail.telepac.pt> wrote in
>news:3qnk7ug977hk4peorufobtlo38nh8j9v87 at 4ax.com:
>> I have put all my own modules in a subdirectory of site-packages.
>> How can I instruct Python (I'm using Python 2.2 on win2k) to also
>> look up this directory when a
>> import <whatever>
>> is found?
>if you put it in site packeages it should be a package... this means
>the directory should have an __init__.py in it. then you can use it
>>>> import yourdir.yourmodule
Hmmm... Now that you tell me it does seem obvious... *rolls eyes*
>or you can put your modules anywhere and create a ".pth" file with
>the path in it. this is appended on sys.path on startup.
>and then there is the PYTHONPATH environment variable.
>or you can add you path to sys.path in sitecustomize.py
This last one seems to be the best.
More information about the Python-list