Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

cleaning up python on ubuntu

Tags:

python

ubuntu

My use case is probably not unusual. I want to use Ubuntu and the Google App Engine. The latest Ubuntu has a version of Python which is not GAE compatible so it was necessary to go back to Python 2.5.5.

After doing so, "whereis python" reveals this mess:

python: /usr/bin/python /usr/bin/python2.6 /etc/python /etc/python2.6 
/usr/lib/python2.5 /usr/lib/python /usr/lib/python2.7 
/usr/lib/python2.6 /usr/lib64/python2.5 /usr/lib64/python 
/usr/lib64/python2.7 /usr/lib64/python2.6 /usr/local/bin/python2.5 
/usr/local/bin/python2.5-config /usr/local/bin/python 
/usr/local/lib/python2.5 /usr/local/lib/python2.6 
/usr/include/python2.6 /usr/share/python /usr/share/man/man1/python.1.gz

Should this be cleaned up or would cleaning it up be a risky waste of time? How would it be cleaned up? Was this avoidable? I realize a certain amount of this was by (linux) design but could some of that designed-in clutter have been minimized given that I know I always intend to have a one-user linux system?

like image 731
H2ONaCl Avatar asked Oct 13 '22 17:10

H2ONaCl


1 Answers

Python is a very important utility used by apt and other packages on your system. I would try to undo whatever installation you did. When you reinstall python 2.5, install using the "altinstall" mechanism to keep python2.5 pointing to the old version:

E.g.:

# apt-get build-dep python
# wget my-python-2.5.tar.bz2
# tar -xvjf ...tar.bz2
# cd Python*
# ./configure --prefix=/usr
# make
# make altinstall

From then on, python and python2.x is still pointing to the standard python that came with the system, while python2.5 is pointing to python2.5, and you can use that in any of your applications (and select it as default in virtualenv.)

like image 125
Mike Axiak Avatar answered Oct 16 '22 08:10

Mike Axiak