I need to have 2 versions of Python installed on my PC. The first must be the latest version in order to use youtube-dl, and the second must be the 2.7 version for a course that says we must not upgrade to get the same results.
I'm on Ubuntu 12.04. How can I have two different versions of Python without using virtual machines?
You can just install them alongside eachother.
I think by default Python 2.7 will be used (i.e. is symlinked to
/usr/bin/python
). You can change this by changing that symlink. Most Python programs will specify which version they need and use it automatically.Changing the symlink is not advised, as it is likely to cause programs to return errors.
Look into virtualenv. You can install multiple versions of python, each in their own virtual environment, and then activate the one you want to use. Inside the virtual environment, you can install other tools as well.
virtualenv info
Here's another Stack Overflow thread on this
Many programs still use the older Python 2 whereas in Ubuntu 12.10 everything is slowly being ported over to the new Python 3 instead so that hopefully on release every program in the repository will use the newer version and you will only have that installed by default...