I had a Python version 2.7.6 installed on Ubuntu 14.04.
By mistake I ran:
sudo apt-get install python-dev
So it changed to Python 2.7.9.
Now I want to revert to 2.7.6. How can I do this?
A quick side-bar before we start breaking things... Is this really a problem? All 2.7.* versions should be compatible. The differences in release are basically just bug-fixes.
Update from comment: If you're seeing weird missing modules in virtualenvs, that's a common symptom of your system python version being updated. When you create a virtualenv, it copies the executable binary out to your virtualenv. If you replace the system version with a new version, any static bindings from the copy to other [python] system libraries might not align.
The quickest fix there is just re-creating the virtualenv. If you haven't already, this is a great opportunity to create a requirements.txt
file in the root of your project. When you're recreated the base virtualenv you can just:
pip install -Ur requirements.txt
The same again to update packages.
The versions of the python2.7
package currently distributed show that Trusty only natively gets 2.7.6. The reason you have 2.7.9 is down to something you've done. Ie, it hasn't upgraded itself.
You've either:
Installed it somehow.
The how really matters here. If you've manually dragged a newer python2.7-minimal
over, reverting to the older version is probably not too hard with sudo apt-get install python2.7-minimal==2.7.6-8ubuntu0.2
(at the time of writing) but if you've installed a PPA, you'll need to purge that.
Upgraded to Vivid which ships 2.7.9.
Check cat /etc/lsb-release
. If you are, you're on an end of life system (dead, dangerous) so upgrade to Wily. That'll push you onto Python 2.7.10 but again, I don't consider that a problem in itself. If that really is for you, reinstalling 14.04 has just been added to your plans for the day.
requirements.txt
and recreating them is super-easy with pip install -Ur requirements.txt
)
You can have different python versions at the same time installed. Look at this site for details : https://geekforum.wordpress.com/2013/05/13/upgrade-downgrade-python/