Skip to content

Instantly share code, notes, and snippets.

@wellic
Created October 13, 2020 06:28
Show Gist options
  • Save wellic/5e3c65dcd3011dc8e87844d896a6d69e to your computer and use it in GitHub Desktop.
Save wellic/5e3c65dcd3011dc8e87844d896a6d69e to your computer and use it in GitHub Desktop.
Deadsnakes python 3.8 on Ubuntu 18.04 LTS

Deadsnakes python 3.8.0 on Ubuntu 18.04 LTS

The deadsnakes PPA make the latest stable versions of python available on LTS distributions. I now find it preferable to installing from source, whether from download or using pyenv.

The following was tested on a stock Ubuntu 18.04.3 LTS desktop with python 2.7.15 and 3.68 as the shipping system python versions. The pip3 binary was install using the stock python3-pip package, updated with pip3 install --upgrade pip.

One of the key reasons this works for me is that I've been aggressive about individually virtualizing project environments with venv.

First, add the deadsnakes PPA to apt:

$ sudo add-apt-repository ppa:deadsnakes/ppa

Next, do the usual update and upgrade:

$ sudo apt update -y && sudo apt upgrade

Then install the basic python3.8 packages:

$ sudo apt install python3.8 python3.8-dev python3.8-venv

This will install the python3.8 binary to /usr/local/bin.

Fire it up to verify the install:

$ python3.8
Python 3.8.0 (default, Oct 14 2019, 21:29:03) 
[GCC 7.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> quit()

Finally, make sure you can create a virtual environment:

$ cd testing
$ python3.8 -m venv venv
$ source venv/bin/activate
(venv) $ python --version
Python 3.8.0
(venv) $
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment