How to install the latest Python version on Debian separately or upgrade?
I'm still new to Linux, so I'm still trying to understand where executables and their libraries are and how to install packages, so I have Debian Wheezy 7.3 which has these Python versions:
- Python 2.7.3 (default)
- Python 2.6.8
So in the directory
/usr/bin/there are these files that I can call from the terminal:
- python (which is a link to python2.7)
- python2 (also a link to python2.7)
- python2.6 (Python 2.6.8 executable)
- python2.7 (Python 2.7.3 executable)
/usr/lib/, the main folders:
Currently the latest version of Python is 2.7.6 which I want to install, but I don't know how, I tried using apt-get:
apt-get install python
python is already the newest version..
So how can I install the latest version of Python ? on the Python download page there is the source tarball, how can I use that to install it separately like having another folder in
python2.7.6and make the
/usr/bin/point to the new executable, or maybe upgrade the current version if it won't break anything.
You could backport Python 2.7.6 from testing/unstable and replace your curent 2.7.3 with it. This will most likely not cause you any problems. If it does, you can easily revert back.
You probably are looking for
pyenvor some other non-system-wide method to install Python. The method using APT (Advance Package Tool) and
dpkg, ensures that all parts of the system are working in harmony, so you maybe want to install python in a separated path, hidden of all the other programs that you can call at will, which is the purpose of
virtualenv. This answers how to install the latest version of python without breaking the system.
BTW, you can check out the latest version of python that Debian in madison, while the latest version of python 2 at the date is the one you pointed out:
➜ ~ apt-cache policy python python: Installed: 2.7.5-5 Candidate: 2.7.5-5 Version table: *** 2.7.5-5 0 500 http://ftp.us.debian.org/debian/ testing/main i386 Packages 100 /var/lib/dpkg/status
(pythonbrew is not longer maintained).
ok I installed pip and virtualenv as root, so how can I create a virtual environment with a new Python version ? as far as I know we need the new version to be installed first right ?