So how do you install later versions of python without impacting the system default version - which is required for all sorts of vital system services?
The trick is to use the prefix and altinstall options when building the new version of python. Make sure you have libsqlite3-dev and libssl-dev installed or Sqlite3 and SSL support won't be compiled in.
tar -jxvf Python-2.7.2.tar.bz2
sudo make altinstall
sudo ln -s /opt/python2.7/bin/python2.7 /usr/bin/python2.7
You (and the system) will continue to use the old version by calling python, and you can use the new version by calling python2.7.
So to install sqlite3 support for python2.7 for instance:
tar -xzf pysqlite-2.6.3.tar.gz
sudo python2.7 setup.py build_static install
Exactly what I was looking for, easy and simple, cheers!ReplyDelete
Exactly what I was looking for(2)ReplyDelete
thx a lot
Greg, thanks for guide. How would you uninstall it correctly? If doesn't affect to the system it's OK just wipe out link and python2.7 folder, right?ReplyDelete
Removing the source directory doesn't get rid of that version of Python - the cleanest way to do that is using the make tool to uninstall.ReplyDelete
Go back to the source directory (~/src/Python-2.7.2/ in the example above) and enter "sudo make uninstall". Then you can remove the source directory, and that version of Python is now history.
This comment has been removed by the author.ReplyDelete
Thanks a lot!ReplyDelete
Only one remark: for sqlite3 in Python2.7.5 my system (Debian 6) required installing libsqlite3-dev.