Installing Python On GNU/Linux

You are not logged in.

If you are a current student, please Log In for full access to the web site.
Note that this link will take you to an external site ( to authenticate, and then you will be redirected back to this page.

From Package Manager

Most major GNU/Linux distributions will have Python 3.5 or 3.6 available in their repositories, and so it may be possible to install an appropriate Python version from its package manager (typically, the python3 package). If so, it is fine to install from there.

From Source

It is also possible to compile Python from source. Below is the sequence of commands necessary to compile Python 3.6 on Debian Stretch:

$ sudo apt-get -y build-dep python3
$ sudo apt-get -y install build-essential libncurses5-dev libncursesw5-dev libreadline6-dev libdb5.3-dev libgdbm-dev libsqlite3-dev libssl-dev libbz2-dev libexpat1-dev liblzma-dev zlib1g-dev tk-dev
$ wget
$ tar xvf Python-3.6.2.tar.xz
$ cd Python-3.6.2
$ ./configure
$ make
$ sudo make install

These commands first install the software necessary to build Python, and then compile and install it. You can test that it worked by running python3 from a command prompt (note that it should report its version as 3.6.x).