Installing Python 2.6/3.0 without breaking stuff
Posted on Aug. 23, 2008 by Ben Dickson.
This is an old post from 2008. The content may be outdated or no longer relevant.
This is an old post I wrote, which was originally posted on neverfear.org on Sat, 23rd Aug 2008 20:46:53. Archived here for posterity.
Pretty simple to do, but regardless here is a copy-and-paste'able set of commands that should work on OS X/Linux (if you have the Apple Developer Tools installed, or the build-essential package on Ubuntu):
cd /tmp/
curl -O http://www.python.org/ftp/python/2.6/Python-2.6b3.tgz
gunzip Python-2.6b3.tgz
tar -xf Python-2.6b3.tar
cd Python-2.6b3/
./configure --prefix=/usr/local/python2.6
# lots of lines ending in "... yes" hopefully
make
# will take a while, no errors
sudo make install
# enter your password, as it requires root access to put files in /usr/local/
# lots of stuff flies by..
sudo ln -s /usr/local/python2.6/bin/python2.6 /usr/local/bin/python2.6
sudo ln -s /usr/local/python2.6/bin/2to3 /usr/local/bin/2to3
# this puts python2.6 into your $PATH</pre class='code'>
That will install python2.6 into
/usr/local/python2.6/
and symlink the commands
python2.6
and
2to3
into
/usr/local/bin/
Then you just run
python2.6 /path/to/myscript.py
To see warnings about things that will break in Python3, run
python2.6 -r /path/to/myscript.py