How can I easily install a newer version of python on Ubuntu 14.04 using apt-get without upgrading the entire OS?
Using the newest python version
It is not recommended to change the python version of your system (i.e. with apt-get update python
), since many scripts rely on a specific version. You can brake your system and it may cause problems with future updates. Instead, you may want to have a look at virtual environments as answered here.
Using python 3
According to the Ubuntu 14.04.5 manifesto, python 3.4
is now included with trusty by default. You can use it with the command: python3 <path-to-some-optional-script>
.
Replace the official repositories / Maintain packages
There is no such thing as the mentioned magical repository. However, there are Personal Package Archives instead, providing newer package version (also triggered by a apt-get update
) and are maintained by the community. There is a question covering this topic on SE here.
You can also download .deb
files with a newer version and use the tool gdebi to install them. However, you will need to take care of newer versions when using local .deb
-files.
Related videos on Youtube
Alex Ryan
Updated on September 18, 2022Comments
-
Alex Ryan almost 2 years
I am stuck on Ubuntu 14.04 and upgrading to 15.10 is probably not an option. The highest version of python supported by Ubuntu 14 is 2.7.6.
This is very old. I want to install a newer version.I understand that all I need is a .deb version of the software that I'd like to install. I think I just need to find a server that has this and added it to the list of repositories (
/etc/apt/sources.list
) and thenapt-get
will magically do the right thing.However, I am going to want to break the rules and install newer versions of other software too. The more often I do this, the more likely bad things are to happen of course. However, I suspect that there are MANY people in my shoes who want to do the same thing. So maybe there is repository for rule breakers like myself can use to replace the official Ubuntu repositories?
Does such a magical repository exist?
If I add it to
/etc/apt/sources.list
, willapt-get install python
give me a newer version of python than is available via the official repositories?-
muru over 8 yearsSuppose there exists such a magical repository. What software should it contain?
-
-
Marcus over 6 years@Zanna thanks, well spotted. According to manifest, it seems to be the case since 14.04.3. I'll update my answer.
-
arn-arn over 4 yearssomehow this worked for me after a couple of tries and opening/closing the terminal.