linux & users' python-extensions

Alex Martelli aleaxit at yahoo.com
Mon Apr 9 15:06:14 EDT 2001


"Pawe³ Sto³owski" <pawelstol at poczta.onet.pl> wrote in message
news:slrn.pl.9d3u29.e3p.pawelstol at localhost.localdomain...
> I've installed Python into /usr/local/bin and /usr/local/lib/Python2.0.
> Now I'd like to allow an ordinary user to maintain his own
python-extensions
> modules (written in C/C++). So, each user's python programs should see
> the global modules hierarchy, but also allow the user to import his own
> modules and link coresponding C/C++ modules, when needed. Is it possible
> without cluttering global Python-configuration each time an user needs
> to play with his new extension-module? I'm new to Python, so any help
> will be appreciated; I found lots of docs on the web, but I can't find
> the exact answer to the above question (if it exists at all).

There are many approaches, but the simplest one may be to notice
that each user can freely set his or her own preferred value for the
environment variable PYTHONPATH, and its contents (parsed from a
colon-separated string, into a list of strings) will be prepended to the
initial value of sys.path upon entry to Python scripts.  Each user can
do it at will in his or her own starting shell scripts, or otherwise, so
the hassle for the administrator should be minimal.


Alex






More information about the Python-list mailing list