conflict between multiple installs of python (linux)

casevh casevh at gmail.com
Sat Jul 5 15:04:51 EDT 2008


On Jul 5, 11:09 am, david <dgel... at gmail.com> wrote:
> You learn something new every day:
>
> On my ubuntu, update-manager is supposed to use the python2.5
> installed on /usr/bin. Well, I had subsequently installed a whole
> bunch of stuff in /usr/local (/usr/local/bin/python and /usr/local/lib/
> python2.5 etc), which I have happily been using for development for a
> year. I had thought that the two pythons were completely independent.
>
> Well, I was wrong. When /usr/bin/python2.5 runs, *by default*, it
> adds /usr/local/lib/python2.5 to its sys path - and apparently there
> are things in /usr/local which are inconsistent with those at /usr
> (not suprising).
>
> I have fixed the problem - but I had to modify the actual update-
> manager .py file itself. At the beginning, I set the sys.path in
> python *explicitly* to not include the /usr/local stuff.
>
> But this is clearly a kludge. My question: how do I keep the Ubuntu
> python stuff at /usr/bin/python2.5 from adding /usr/local/lib/
> python2.5 to the import search path in a clean and global way? I
> really want both pythons completely isolated from one another!
>
> Thankyou.

Python's path is build by site.py. In the file /usr/lib/python2.5/
site.py, look for the line "prefixes.insert(0, '/usr/local')" and
comment it out. That should do it.

casevh



More information about the Python-list mailing list