Ubuntu 14.4 comes with Python 2.7.6 built-in, but I'd like to upgrade it to 2.7.9 (it has security features that I want).
Is that even possible? If so, how can this be achieved?
Ubuntu 14.4 comes with Python 2.7.6 built-in, but I'd like to upgrade it to 2.7.9 (it has security features that I want).
Is that even possible? If so, how can this be achieved?
ppa:fkrull/deadsnakes is the latest version of python2.7
It will upgrade python to 2.7.10
You can use pyenv:
Then add
to .bash_profile then you can see the python version you want to install or update:
want python 2.7.18? First you install it:
after which you can create a virtualenv using it:
Hope it can help you.
I'm not a fan of previous answers suggesting installing from various PPAs. No disrespect intended, but I don't know the people who built them and I have no idea what might be in there. In any environment where someone has to answer to a security professional that practice would be frowned upon.
I just found that downloading 2.7.18 from source and installing it side-by-side was a good start. This awesome blog post covered the steps. (recreated here to conform to stack overflow guidelines)
Test if the version works
Now that I have 2.7.18 installed I can call it directly or symlink to it from wherever I want. (or copy it into a virtualenv etc.)
And note that I got here from a situation where I was getting insecure platform warnings, and SNI Missing warnings. Which led me here. I imagine many people are finding this question through the same path. And if that's why you're here this snippet may be of use to you too
Here is new upgraded third party repository:
You can go to the python.org and download the .tar.gz file compile and install it. You will need the basic tools in order to compile the source code. I don't remember if the "build-essential" package will suffice but give it a try.
The version you want is already in Ubuntu, in Vivid (pre)release. If you are brave, you can mix releases and install Vivid's version of Python under Trusty. Below is a generic solution that works on some packages, I can't warranty it with Python. The chances are ~ 50/50 that it will succeed. If you however find a proper backports repository for 14.04 with your required package version, then it should be a better choice.
You have '... trusty main' line in your
/etc/apt/sources.list
, copy it twice, changing 'trusty' to 'utopic' and 'vivid'.Run
apt-get update
and thenapt-get -t vivid install python2.7
. Review dependencies installed before proceeding. Abort upgrade when you suspect any damage to your system (deleted important packages, etc.).Remove or hash the two lines from
/etc/apt/sources.list
.Never do it on production machines. Make a backup of your OS and prepare boot media to restore it if needed. Expect problems on upgrades. You've been warned.