How to install the exact python version on Ubuntu/Windows WSL 2
If you are on Windows follow WSL 2 installation guide first.
Add dead snakes PPA, this is a special DEB repository that holds all python versions. Compatible with all Debian bases repositories: Ubuntu, Mint, WSL2 Ubuntu
sudo apt update | |
sudo apt install software-properties-common | |
sudo add-apt-repository ppa:deadsnakes/ppa |
Now type the next command to install the main python DEB package of a specific version:
sudo apt install python3.7
Instead of 3.7 use any version you need.
For some specific projects and packages you might also need other DEB packages:
python#.#-dev
: includes development headers for building C extensionspython#.#-venv
: provides the standard libraryvenv
modulepython#.#-distutils
: provides the standard librarydistutils
modulepython#.#-lib2to3
: provides the2to3-#.#
utility as well as the standard