Installing Python on GNU/Linux
Please Log In for full access to the web site.
Note that this link will take you to an external site (https://shimmer.mit.edu) to authenticate, and then you will be redirected back to this page.
From Package Manager
It is possible that your distribution of GNU/Linux makes Python 3.6 or 3.7
available from its package manager (typically, as a package called python3
).
If so, it is fine to install from there. In that case, you will also need to
install python3-tk
, idle3
, python3-matplotlib
, python3-numpy
, and
python3-scipy
.
From Source
Some distributions (for example, Debian Jessie) do not yet have Python 3.6 or 3.7 in their repositories. On such systems, you will need to compile Python from source. Below is the sequence of commands necessary to compile Python 3.6.5 on Debian Jessie:
$ 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 https://www.python.org/ftp/python/3.6.5/Python-3.6.5.tgz
$ tar xvfz Python-3.6.5.tgz
$ cd Python-3.6.5
$ ./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.5).
Once you have installed Python, you will still need to install the other packages by running the following from the command line:
$ sudo pip3 install numpy scipy matplotlib
This may take a while, so be patient. While you're waiting, you can read a little about how we just installed these packages here--the process will be useful if you'd like to install other packages in the future.