install python 2.6 on Ubuntu 12.04

Christian Heimes lists at cheimes.de
Wed May 23 03:40:53 EDT 2012


Am 23.05.2012 02:51, schrieb Benjamin Kaplan:
> Even easier:
> 
> ./configure
> make
> sudo make altinstall
> 
> If I recall correctly, that will install it in
> /usr/local/lib/python2.6 and it will create /usr/local/bin/python2.6
> but it will not create /usr/local/bin/python so it won't clobber the
> system python.

You recall correctly. That's the recommended and correct way to install
Python 2.6 on a recent machine, with one exception. You must compile it
with the option MACHDEP=linux2, otherwise sys.platform will contain the
string "linux3" [1]. You also must set LDFLAGS and some other flags
because Python 2.6 doesn't support multiarch systems. [2] It's all in my
blog.

My default settings are:

export arch=$(dpkg-architecture -qDEB_HOST_MULTIARCH)
export LDFLAGS="-L/usr/lib/$arch -L/lib/$arch"
export CFLAGS="-I/usr/include/$arch"
export CPPFLAGS="-I/usr/include/$arch"
./configure --enable-shared --enable-unicode=ucs4 --config-cache
make MACHDEP=linux2 -j3
sudo make altinstall

Christian

[1]
http://lipyrary.blogspot.de/2011/09/python-and-linux-kernel-30-sysplatform.html
[2]
http://lipyrary.blogspot.de/2011/05/how-to-compile-python-on-ubuntu-1104.html






More information about the Python-list mailing list