1

I almost broke my Ubuntu installation trying to install python 3.7 from the source using checkinstall.
My question is how to install python 3.7 and it's equivalent ipython alongside with python 3.5 without breaking everything related to the native python installation ?

1 Answers1

1

First we need to double check what are the currents installed version using the following commands python --version and/or python3 --version

The we make sure that the latest version of Debian is installed before the python installation.

A simple apt-get update and apt-get dist-upgrade followed by rebooting the computer will do.

Then, in order to verify the key signature of the python tar file we need to install DirMngr if it's not already installed:

sudo apt-get install  dirmngr

After that we can retrieve the OpenPGP Public Keys from the python downnload page and pass it out to the following command line:

gpg --recv-key AA65421D

and use it to verify the downloaded version

gpg --verify Python-3.6.4.tar.xz.asc

(3.6.4 can be changed for the specific version downloaded from python website)

From here, we copy our tar file to src folder

sudo cp ~/Downloads//Python-3.6.4.tar.xz /usr/src/

And we cd to the src folder and we untar the archive

cd /usr/src/ && sudo tar -xf Python-3.6.4.tar.xz

The following dependencies may be needed before compiling

sudo apt-get install build-essential checkinstall zlib1g zlib1g-dev openssl
sudo apt-get install libreadline-gplv2-dev libncursesw5-dev libssl-dev libsqlite3-dev tk-dev libgdbm-dev libc6-dev libbz2-dev
sudo apt-get build-dep python3.5

The next step is to configure and install using altinstall to avoid versions conflict and to break program already running with the previous python version

sudo ./configure
sudo make altinstall

To run the 3.7 version you can simply use python3.7 to launch the interpreter and to install the equivalent ipython you can use this command

python3.7 -m pip install ipython