sys.path with multiple Python installations

Gabriel Genellina gagsl-py2 at yahoo.com.ar
Wed Mar 4 23:55:23 EST 2009


En Thu, 05 Mar 2009 01:48:44 -0200, Xavier Lapointe Desjardins  
<lapointe.xavier at gmail.com> escribió:

> this is my first post on the mailing list, so I'll try to be clear
> enough. I've on my computer WinXp x64 with  python 2.5 and 2.6
> installed. When I tried to run a small script using smtplib using Python
> 2.6, I got that error message:
>
> "
> Traceback (most recent call last):
>   File "< My projet path >\sandbox.py", line 2, in <module>
>     import smtplib
>   File "C:\Python25\Lib\smtplib.py", line 44, in <module>
>     import socket
>   File "C:\Python25\Lib\socket.py", line 45, in <module>
>     import _socket
> ImportError: Module use of python25.dll conflicts with this version of
> Python.
>
> "
>
>
> So as you can see, it looks inside Python 2.5 directories, not 2.6. I
> took a look at both sys.path (2.5 and 2.6), and remarked that Python 2.5
> have its own path list, but 2.6 got its own + the 2.5 paths creating
> conflicts.
> Is there a way to avoid this? I thought removing every single path in
> python 2.6 that linked to 2.5, but maybe there's another reason/solution
> or something I should know?

How did you install both versions exactly? They should coexist peacefully.
What do you mean "a path in python 2.6 that linked to 2.5"?
Do you have a PYTHONPATH environment variable set? (you shouldn't).
Look for any .pth file with absolute paths inside it.

-- 
Gabriel Genellina




More information about the Python-list mailing list