Installing Python 2.6 on Ubuntu 8.04
来源:互联网 发布:免费的vpn软件 编辑:程序博客网 时间:2024/06/05 01:51
I wanted to 'upgrade' mypython from 2.5 to 2.6 on Ubuntu. Unfortunately, I could not find .debpackages for Ubuntu. Fortunately, the Python 2.6 sources (sig) are available, so I can compile it from source. Here's what I had to do to get it running. (Short version: apt-get build-dep python2.5
and apply this patch to disable unavailable and outdated modules.)
Ihave Python 2.5 installed and wanted to keep it, as Ubuntu 8.04 is along term support version and I did not want to break this support bychanging to a maybe non-compatible Python version.
Python uses a configure-style installation procedure. First, extract the Python sources:
tar xzf Python-2.6.tgz
cd Python-2.6
I configured Python to stay out of my usual directories and install itself to /opt/python2.6
:
./configure --prefix=/opt/python2.6
make
I thought that's all, however I get an error message like this:
Failed to find the necessary bits to build these modules:
_hashlib _ssl bsddb185
bz2 gdbm readline
sunaudiodev
To find the necessary bits, look in setup.py in detect_modules() for the module's name.
The easiest way to fix is to install the build dependencies forPython 2.5, because they seem to be identical to the build dependenciesof Python 2.6:
apt-get build-dep python2.5
make
However, there's still an error message:
Failed to find the necessary bits to build these modules:
bsddb185 sunaudiodev
To find the necessary bits, look in setup.py in detect_modules() for the module's name.
bsddb185
refers to the historic version 1.85 of Berkeley DB (now Oracle Berkeley DB), and sunaudiodev
is necessary for audio stuff on Sun. I'm wondering why Python tried tofind 'the necessary bits to build these modules', as I don't run a 1.85version of Berkeley DB, nor do I use Sun. Unfortunately, I could notfind any documentation on how to switch off compiling these sources. Iguess, this could be improved.
Anyways, hacking setup.py was the way to go. Of course, it is not as easy as adding bsddb185
and sunaudiodev
to the disabled_modules
list at the beginning of setup.py. So I hacked the (bogus) test for the modules in detect_modules
like the error message suggested, resulting in this patch.
patch -p1 < python2.6-disable-old-modules.patch
make
sudo make install
This installed python 2.6 into /opt/python2.6. Set up links to your bin directory, and you're done.
ln -s /opt/python2.6/bin/python2.6 ~/.root/bin/python-2.6
ln -s /opt/python2.6/bin/pydoc ~/.root/bin/pydoc-2.6
Usually, I use checkinstall,but this time everything is nicely packed into /opt/python2.6, which Ican just delete, should I ever want to get rid of Python 2.6 (which Idoubt).
Notes
The first time I ran, I got this message:
Failed to find the necessary bits to build these modules:
_hashlib _ssl bsddb185
bz2 gdbm readline
sunaudiodev
To find the necessary bits, look in setup.py in detect_modules() for the module's name.
I think I found Ubuntu packages for some of them:
- _hashlib and _ssl in libssl-dev
- bz2 in libbz2-dev
- gdbm in libgdbm-dev
- readline in libreadline5-dev
- Installing Python 2.6 on Ubuntu 8.04
- Installing Python 2.7 on Ubuntu
- Installing vsftp on ubuntu 8.04
- Installing Aptana on Ubuntu 8.04
- Installing FOSSology 2.6 on Ubuntu
- Installing Python 2.7 on Ubuntu 10.04
- Installing Python 2.7.5 on Ubuntu
- Installing ImageMagick from Source on Ubuntu 8.04
- Installing MapServer on Ubuntu
- installing chkconfig on ubuntu
- Installing Jenkins on Ubuntu
- Installing Selenium and PhantomJS for Python 3 on Ubuntu 14.04
- Installing Nemesis on Ubuntu 10.04
- Installing Tomcat 6 on Ubuntu
- Installing Plone 4 on Ubuntu
- Installing Cuda on Ubuntu 11.10
- Installing PostGIS 2.0 on ubuntu
- Installing webrtc2sip on Ubuntu 12.04
- XP服务优化
- 非托管与托管类型的对应
- Oracle数据库封锁和select...[for update [of tab.col]]的研究
- 【转载】日本CPU发展之路简单介绍。
- test
- Installing Python 2.6 on Ubuntu 8.04
- XAML命名空间
- bugzilla在linux下安装后,页面不能访问问题处理
- 基带芯片 基带信号
- 谈谈我对攻读计算机研究生的看法
- object 的作用
- MySQL数据库引擎快速指导
- 《JavaScript凌厉开发 Ext详解与实践》的目录
- C#开发中如何对SqlServer命名规范的总结