How to install Python 3.5.1 on Wily Werewolf 15.10?
Solution 1: Use Docker
I would suggest that you use Docker If you would like to test out a newer version of Python without overwriting your system Python (which it is very important that you don't, because Python 2.x and 3.x are different enough that 3.x will have breaking changes and will cause problems for packages that depend on Python 2.x)
Docker is a way to run lightweight Linux applications in a containerized way. Think of them like a more lightweight Virtual Machine, or a chroot
with a layered union filesystem plus the management & system resource separation provided by cgroups
.
- To install Docker, follow the Ubuntu Installation instructions here.
- To run a different version of python inside a container:
- Pick a version from the list here
- Run:
docker pull python:<your_version_here>
- Run:
docker run -it --rm --name my-running-script -v "$PWD":/usr/src/myapp -w /usr/src/myapp python:<your_version_here> python your-daemon-or-script.py
If you develop an application that you'd like to package up (optionally with dependencies) inside a container, you can create a Dockerfile
with build & dependency setup instructions, then build an image to distribute on Docker Hub. Doing so is a bit beyond the scope of your question, but the docker-library/python
docs give a quick summary for how to get started.
Solution 2: Use packages from the "dead snakes" PPA
There is an archive of old & new versions of Python here. To install an alternate version of Python:
- Run:
apt-get -y install software-properties-common
- Run:
sudo add-apt-repository ppa:fkrull/deadsnakes
- Run:
sudo apt-get update
- Run:
sudo apt-get -y install python<your_version_here> python<your_version_here>-dev
- To run a Python script with one of these versions, use the alternate binary that was installed.
- Run:
python<your_version_here> your-daemon-or-script.py
- For Example, with Python 3.5:
/usr/bin/python3.5 your-daemon-or-script.py
- Run:
If you need to install a specific minor version of the package, you can find the available versions with apt-cache madison
. For example, let's say we wanted to install a specific version of python3.4
:
$ apt-cache madison python3.4
python3.4 | 3.4.3-1ubuntu1~14.04.3 | http://archive.ubuntu.com/ubuntu/ trusty-updates/main amd64 Packages
python3.4 | 3.4.0-2ubuntu1.1 | http://archive.ubuntu.com/ubuntu/ trusty-security/main amd64 Packages
python3.4 | 3.4.0-2ubuntu1 | http://archive.ubuntu.com/ubuntu/ trusty/main amd64 Packages
python3.4 | 3.4.0-2ubuntu1 | http://archive.ubuntu.com/ubuntu/ trusty/main Sources
python3.4 | 3.4.3-1ubuntu1~14.04.3 | http://archive.ubuntu.com/ubuntu/ trusty-updates/main Sources
python3.4 | 3.4.0-2ubuntu1.1 | http://archive.ubuntu.com/ubuntu/ trusty-security/main Sources
# To install a specific version, suffix the package name with =<version_here>
# For example:
$ apt-get -y install python3.4=3.4.0-2ubuntu1
Related videos on Youtube
andrew.46
The Tao is close, but you look far away. Life is simple yet you look for problems...
Updated on September 18, 2022Comments
-
andrew.46 over 1 year
Python 3.5.1 came out on December 7th 2015 and as a beginning Python coder I would like to try the very latest version on my Ubuntu installation. At the moment Wily Werewolf 15.10 ships version 3.4 and there are some great improvements in the newest version.
I am currently running Wily Werewolf and I would be keen to hear some methods to update Python to 3.5.1.
-
wb9688 over 8 yearsCompile it from source...
-
muru over 8 yearsThe deadsnakes PPA does have 3.5.1 for 14.04.
-
andrew.46 over 8 yearsD'oh! My question does look a little too close for comfort to the one muru has linked :(. Apologies....
-
Ben Middleton over 8 yearsoh well... I gave an answer anyway ;-)
-
LittleByBlue about 8 years@wb9688 actually this will mess your system up: I tried it and I would not suggest a newbie to install it from source.
-
-
LittleByBlue about 8 yearsdoes not work with
15.10 wily
. But the best answer for this topic so far. -
Ben Middleton about 8 yearsIf the "Dead Snakes" PPA does not support
15.10 wily
yet, you might want to try thedocker
solution -
Ben Middleton about 8 yearsJust checked, and it looks like deadsnakes does say it supports wily and appears to have packages for that distro.
-
LittleByBlue about 8 yearsUh sorry I forgot to say, that I was talking about the solution #2. deadsnakes supports
wily
but notpython3.5.1
. -
andrew.46 about 8 yearsI have actually changed the question a little reflect only Wily Werewolf. Pity Wily is EOL soon enough but I would like to make the question a non-duplicate...