I downloaded Lubuntu LTS 18.04 and there is Python 3.6.9 IDLE which is built-in. But since it is very old, I want to update to 3.8. How do I do that?

  • 4
    The OS is almost two years old, so the software is almost two years old. That's how it works. For newer software, use a newer release. DO NOT change the system-provided version of Python3. Doing so will break your system quite horribly.
    – user535733
    Commented Dec 21, 2019 at 14:17
  • Break the system? What does this mean?
    – Gathide
    Commented Oct 12, 2020 at 16:18
  • something like sudo cp python3.8 python3 might break things. Commented May 17, 2021 at 9:18

3 Answers 3


This post is community wiki so as to not claim the credit of @Kulfy's comment. This procedure worked on Ubuntu 18.04.

DON'T EVER CHANGE DEFAULT PYTHON!!! It may cause your system to break and some applications won't even run. It's far far far better to invoke python3.8 using python3.8 command

When installing python3.8, do the following

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

For most people this will be acceptable as they will be using a virtual environment for development. Construct a virtual environment and activate it as you usually would. This will leave you in a terminal where python resolves to python3.8:

$ python3.8 -m venv dev3.8/
$ source dev3.8/bin/activate
(dev3.8) $ which python
(dev3.8) $ python --version
Python 3.8.0

Neglecting to install python3.8-venv will result in an unhelpful error, that suggests you should install python-venv which resolves to python3.6-venv:

$ python3.8 -m venv dev3.8/
The virtual environment was not created successfully because ensurepip is not
available.  On Debian/Ubuntu systems, you need to install the python3-venv
package using the following command.

    apt-get install python3-venv

You may need to use sudo with that command.  After installing the python3-venv
package, recreate your virtual environment.

Failing command: ... (trimmed for formatting)
  • 2
    On a fresh install of 18.04, I still received the ensurepip error even though python3.8-venv had been installed. Had to also install python3.8-distutils to resolve the virtual environment creation error. Commented Jun 6, 2020 at 18:26
  • Doing the above works. However, when installing whatever happens to be in my requirements.txt logs this: Using legacy 'setup.py install' for <package>, since package 'wheel' is not installed. Any reason not to install wheel? Commented Aug 24, 2021 at 15:26
  • @SnakeVerde It's worth having wheel installed but I tend to install it in my local virtual environment. I have a small litany of commands that I execute whenever I'm modifying a virtual environment (to install packages or updates, etc). After entering into the virtual environment but before doing anything special, invoke pip install --upgrade pip setuptools wheel. This keeps pip from yelling about older versions and ensures that any package upgrades are using the most up-to-date versions of whatever build tools are relevant.
    – Rob Hall
    Commented Oct 5, 2021 at 19:58
  • python3.8-distutils does not exist (anymore?) in the standard Ubuntu packages repository (packages.ubuntu.com/…). How does this affect this answer? Should installing the other listed packages still result in a complete Python 3.8 installation with working Pip? Commented Jul 7, 2022 at 21:26

Step 1: Install the latest version of python. Currently, 3.8 is the latest

sudo apt install python3.8

Step 2: Add Python 3.6 & Python 3.8 to update-alternatives

sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.6.9
sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.8.1

Step 3: Update Python 3 to point to Python 3.7

By default, Python 3.6 is pointed to Python 3. So, we run python3 it will execute as python3.6 but we want to execute this as python3.8

sudo update-alternatives --config python3

versions You should get a similar output. Now type 2 and hit enter for Python 3.

Step 4: Test the version of python

Finally test the current version of python by typing

python3 -V
  • 18
    DON'T EVER CHANGE DEFAULT PYTHON!!! It may cause your system to break and some applications won't even run. It's far far far better to invoke python3.8 using python3.8 command.
    – Kulfy
    Commented Dec 21, 2019 at 14:53
  • 2
    I was not able to open teminal after following the solution.
    – Jeril
    Commented Apr 20, 2020 at 6:24
  • In Ubuntu 18.04, I did the above to set python3 to be 3.8, then without logging out or closing my existing terminal window, tried to start a new second terminal window. The Ubuntu wait cursor spun and nothing happened. I repeated the attempt but still no terminal started. I then reset /usr/bin/python3 back to 3.6 (by repeating the update-alternatives command with a higher priority), tried to start a new terminal window, and it worked. Conclusion: as others have stated, do not change /usr/bin/python3 – leave it at 3.6.
    – mhucka
    Commented Aug 18, 2021 at 17:06
  1. Run the following commands as root or user with sudo access to update the package list and install the prerequisites:

    sudo apt update
    sudo apt install software-properties-common
  2. Add the deadsnakes PPA to your sysmtem's source list:

    sudo add-apt-repository ppa:deadsnakes/ppa
  3. Install Python 3.8 with following command:

    sudo apt install python3.8
  4. Verify the installation:

    python3.8 --version
  • The accepted answer did not work for me, but this one did. But dont just install python3.8 only, after adding the deadsnakes ppa run the command in the accepted answer to properly install your python version. sudo apt-get install python3.8 python3.8-dev python3.8-distutils python3.8-venv Commented Feb 16, 2023 at 13:01

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .