Where best to put local modules?

Bruno Desthuilliers bruno.42.desthuilliers at wtf.websiteburo.oops.com
Thu Dec 20 10:16:35 EST 2007


tinnews at isbd.co.uk a écrit :
> Bruno Desthuilliers <bdesth.quelquechose at free.quelquepart.fr> wrote:
>> tinnews at isbd.co.uk a écrit :
>>> I'm just beginning to create some python modules for my own use and
>>> I'm wondering where to put them.  Initially I have put them in
>>> $HOME/bin and I have set PYTHONPATH to point to them there.  It all
>>> seems to be OK but I was wondering if I might be storing up problems
>>> for the future by putting python modules in with my odds and sods of
>>> shell scripts etc. (and with my python 'main' scripts).
>>>
>>> Would I be better off putting the modules somewhere else, e.g.
>>> somewhere like $HOME/lib/python?
>>>
>> If you're on a shared system and don't have admin access, this last 
>> solution is probably the best - "pure" modules have nothing to do in a 
>> bin/ directory indeed. Now if it's your own computer, why not just put 
>> them in /path/to/python/libs/site-packages ?
> 
> There's one of each, a system where I have a shell account but not
> root access  and my home system.

> There is a disadvantage of putting stuff in the site-packages directory
> isn't there? If/when I upgrade the system the python modules I have added
> will effectively not be visible to the upgraded system.  I know I can
> copy them across to the new site-packages but it's just one more chore
> when upgrading.  If they were in $HOME/lib/python this issue wouldn't
> arise because /home stays the same across upgrades.
> 

Yes, true. OTHO, storing modules in your own $HOME/whatever and 
modifying your $PYTHONPATH accordingly won't make the modules available 
to other accounts. Which may or not be a problem (it happened to be one 
for me...).



More information about the Python-list mailing list