Wednesday, June 23, 2010

[Py] Work with multiple versions of Python

In Ubuntu 8.04, the default version of Python is 2.5, and I want to try Python 2.6 without messing up Python 2.5. I followed Andreas Bernauer's article but still had problems.

During the installation process, I found another useful article which gives also clear guidance:
Installing multiple versions of Python on Ubuntu from Source

After installing Python 2.6 successfully, I linked python command to Python 2.6, but got some problems. All the third-part packages (installed in the `site-packages' folder) cannot be seen by Python 2.6. I tried to link the folders but got no luck. Then I noticed the ``setuptools'' which claims:
Download, build, install, upgrade, and uninstall Python packages -- easily!
Then followed the steps which also given in Installing multiple versions of Python on Ubuntu from Source. Finally, set link to easy_install, for example:
$ sudo ln -s /opt/python2.6/bin/easy_install-2.6 /usr/bin/easy_install2.6
I installed numpy and matplotlib with easy_install:
$ sudo easy_install2.6 numpy
$ sudo easy_install2.6 matplotlib
The installation of matplotlib got an error message as below:
error: Setup script exited with error: command 'gcc' failed with exit status 1
I followed the method proposed here, and installed ``libpq-dev'' but it didn't work. Then I found the solution which is as follows:
$ sudo apt-get build-dep matplotlib
So far, one thing is still bothering me. I have no idea how to let IPython work with Python 2.6.

No comments:

Post a Comment