NEWBIE: for statement in "dive into python" gives syntax error.

John Hunter jdhunter at nitace.bsd.uchicago.edu
Tue Jul 23 20:18:31 EDT 2002


>>>>> "Mack" == Mack  <gugabbe at hotmail.com> writes:

    Mack> I found out, however, that there were now three pythons in
    Mack> /usr/bin, python, python1.5 and python2. python were
    Mack> identical to python 1.5 so I just did a cp /usr/bin/python2
    Mack> /usr/bin/python. I can always revert if somethings wrong.

Revert, Revert!

A lot of people put their nonstandard applications in /usr/local/bin.
If you get the src distributions from python.org or some mirror,
rather than the SRPMs that ship with redhat, the install will
automatically go to the /usr/local dir by default.  Don't know if you
can do this with rpm.

Also, you'll want to update your PATH environment var to make
/usr/local/bin occur earlier than /usr/bin.  In your bash config file,
do some variant of

export PATH=/usr/local/bin:/usr/bin

Also note that there is a more elegant way than 'cp' to do what you
did when you made python2 the default python.  Say you have two
pythons in /usr/local/bin, python2.1 and python2.2.  You want to make
one of these the default python.  Do this with a symbolic link

> cd /usr/local/python
> ln -s python2.2 python
> ls -l python*

You'll see something like:

lrwxrwxrwx   1 root     root            9 Jul 18 09:10 python -> python2.2
-rwxr-xr-x   1 root     root      2585908 May 31 14:38 python2.1
-rwxr-xr-x   1 root     root      2335384 Jul 17 09:04 python2.2

 So you haven't copied the file (and wasted space) but python now
 points to the latest version and it's easy to revert back to 2.1 by
 doing

> rm python
> ln -s python2.1 python

Have fun,
John Hutner



More information about the Python-list mailing list