"Jeffrey Froman" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Hello All, > > I have two python versions installed, one in /usr/bin, and one in > /usr/local/bin. However, when invoking python without a full path, > I get the wrong executable with the right sys.executable string! > ---------------------------------------------------------------------------- > [EMAIL PROTECTED] ~]# ls -l /usr/local/bin/python* > -rwxr-xr-x 2 root root 3783810 Jul 19 09:15 /usr/local/bin/python > -rwxr-xr-x 2 root root 3783810 Jul 19 09:15 /usr/local/bin/python2.5 > -rwxr-xr-x 1 root root 1281 Jul 19 09:16 > /usr/local/bin/python2.5-config > lrwxrwxrwx 1 root root 16 Jul 19 09:16 > /usr/local/bin/python-config -> python2.5-config > > [EMAIL PROTECTED] ~]# ls -l /usr/bin/python* > -rwxr-xr-x 2 root root 5396 May 2 16:28 /usr/bin/python > lrwxrwxrwx 1 root root 6 Jul 18 12:20 /usr/bin/python2 -> python > -rwxr-xr-x 2 root root 5396 May 2 16:28 /usr/bin/python2.3 > > [EMAIL PROTECTED] ~]# which python > /usr/local/bin/python > > [EMAIL PROTECTED] ~]# /usr/local/bin/python -c "import sys; print > sys.executable; > print sys.version; set()" > /usr/local/bin/python > 2.5 (r25:51908, Jul 19 2007, 09:13:48) > [GCC 3.4.6 20060404 (Red Hat 3.4.6-8)] > > [EMAIL PROTECTED] ~]# env python -c "import sys; print sys.executable; print > sys.version; set()" > /usr/local/bin/python > 2.5 (r25:51908, Jul 19 2007, 09:13:48) > [GCC 3.4.6 20060404 (Red Hat 3.4.6-8)] > > [EMAIL PROTECTED] ~]# python -c "import sys; print sys.executable; print > sys.version; set()" > /usr/local/bin/python > 2.3.4 (#1, May 2 2007, 19:26:00) > [GCC 3.4.6 20060404 (Red Hat 3.4.6-8)] > Traceback (most recent call last): > File "<string>", line 1, in ? > NameError: name 'set' is not defined > --------------------------------------------------------------------------------- > > > On a different machine, with same setup (as far as I can tell), I get the > expected > results: > --------------------------------------------------------------------------------- > [EMAIL PROTECTED] ~]# /usr/local/bin/python -c "import sys; print > sys.executable; > print sys.version; set()" > /usr/local/bin/python > 2.5 (r25:51908, Feb 8 2007, 16:29:18) > [GCC 3.4.6 20060404 (Red Hat 3.4.6-3)] > > [EMAIL PROTECTED] ~]# env python -c "import sys; print sys.executable; print > sys.version; set()" > /usr/local/bin/python > 2.5 (r25:51908, Feb 8 2007, 16:29:18) > [GCC 3.4.6 20060404 (Red Hat 3.4.6-3)] > > [EMAIL PROTECTED] ~]# python -c "import sys; print sys.executable; print > sys.version; set()" > /usr/local/bin/python > 2.5 (r25:51908, Feb 8 2007, 16:29:18) > [GCC 3.4.6 20060404 (Red Hat 3.4.6-3)] > --------------------------------------------------------------------------------- > > Can anyone tell me what might be causing the erroneous behavior in the > first example?
I think it's because your python directory is in the path before your python2.5 directory. -- http://mail.python.org/mailman/listinfo/python-list