How To Upgrade Python 3.7?

Python is a dynamic programming language that is updated regularly. Major updates get a new version like 3.1 or 3.2. Python version 3.7 is very popular and features a full version. Python 3.5 is a popularly installed and deployed version where you may need to upgrade from Python 3.5 to Python 3.7. In this tutorial, we examine how to upgrade to Python 3.7 from different versions.

Upgrade Python 3.7 Using apt-get for Ubuntu, Debian, Mint

The apt or apt-get package-management commands can be used to install or upgrade Python 3.7. Following apt command can be used to install Python3.7.

$ sudo apt install python3.7

Upgrade Python 3.7 Compiling Source Code

Python 3.7 is also provided as source code. Python 3.7 can be also installed by compiling the source code.

$ tar -xf Python-3.7.0.tar.xz

Then we navigate into the extracted Python3.7 directory.

$ cd Python-3.7.0

The next step is configuring the source code for the compilation.

$ ./configure

The following make command is used to compile Python 3.7.

$ make

The following make install command is used to install recently compiled Python 3.7.

$ sudo make install

Select Python 3.7 As Default

On a single system, multiple Python versions can be installed. For example, Python 3.5, Python3.6, and Python 3.7 can exist in the same system. The default version is can be a different Python version which is not Python 3.7. We can make Python 3.7 the default version with the following example.

$ sudo update-alternatives --config python3

Print Python Version

The current of default Python version can be displayed with the -V option.

$ python3 -V

Leave a Comment