How to install Linux Mint 3.7 (the latest one) on Linux Mint 18 with key verification and build from source.

In this post:

You can check also this article:

Ubuntu install latest python and list all python versions

Below you can see all user commands(the details of the steps are below):

gpg --recv-key AA65421D
cd ~/Downloads
gpg --verify Python-3.7.0.tar.xz.asc
sudo cp ~/Desktop/Python-3.7.0.tar.xz /usr/src/
cd /usr/src
sudo tar -xf Python-3.7.0.tar.xz
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
cd Python-3.7.0
sudo ./configure

sudo make altinstall

Download and key verification

In order to download the latest python go here: Download the latest source release

At this page you can check section: OpenPGP Public Keys and select public key.

Select the version(or any other that you want): Python 3.7.0 released on 2018-06-27.

In this tutorial we will work with: Python 3.7.0 and the tar.gz file: XZ compressed source tarball

So you need to download two files:

  • Python-3.7.0.tar.xz
  • Python-3.7.0.tar.xz.asc

You can import all keys or just one:

gpg --recv-keys 6A45C816 36580288 7D9DC8D2 18ADD4FF A4135B38 A74B06BF EA5BBD71 E6DF025C AA65421D 6F5E1540 F73C700D 487034E5

or

gpg --recv-key AA65421D

If you have error with last command you can check: GPG errors

Then go to the download folder and verify the Python download by:

cd ~/Downloads
gpg --verify Python-3.6.4.tar.xz.asc

Installation of Python 3.7

Copy the Python tar file into: /usr/src by:

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

extract the archive with:

sudo tar -xf Python-3.7.0.tar.xz

then install the requirements and related libraries by:

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

Finally go into the Python newly extracted folder and install it:

cd Python-3.7.0
sudo ./configure
sudo make altinstall

Note: this will install Python 3.7 as python3.7 and will not break or interfere with your system installation. If you want to use sudo make install have in mind that your Linux Mint may have errors.

In order to start it and use it you can do it by:

python3.7 -V
which python3.7

PyCharm Setup with virtual Environment

Once Python 3.7 is installed then you may want to use it in PyCharm as a virtual environment in order to do this you need to create virtual environment by:

cd /home/user/envs
virtualenv --system-site-packages -p python3.7 venv370

Installation of pip/virtualenv(optional)

sudo apt-get install python3-pip
sudo pip3 install virtualenv 

Once the environment is created you need to added in PyCharm by:

  • Main Menu
  • Default Settings
  • Project Interpreter
  • Click on the Gear
  • Add Python Interpreter - new dialog is opened
  • Vritual Environment from the left tab - chosen by default
  • Select Existing environment
  • Locate and add your one
    • find the python3.7 file under bin folder of your new environment
  • Check Make available to all projects (optional)

Selection_037