Install Python 3.7.0 on Ubuntu 18.04/Debian 9.5

DZone 's Guide to

Install Python 3.7.0 on Ubuntu 18.04/Debian 9.5

Ubuntu and Debian are two powerful, open source operating systems, and Python is a great language for data science. Learn how to combine their powers!

· Big Data Zone ·
Free Resource

In this post, we will install Python 3.7.0 on Ubuntu 18.04 / Debian 9.5. This is the latest version of the Python Programming Language.

What's New?

Python 3.7 gives us some new features, including:

  • Postponed evaluation of type annotations
  • async and await are now reserved keywords
  • New contextvars and dataclasses library modules
  • New breakpoint() function
  • and more

For more, check out the What's New in Python 3.7 page.


Perform all the updates.

apt update && apt upgrade -y

Install everything we will need to build the source for Python.

apt install build-essential -y
apt install libncurses5-dev libgdbm-dev libnss3-dev libssl-dev libreadline-dev libffi-dev -y

If you are on Debian, then you need to install zlib.

apt install zlib1g -y

First, download the source tarball.

wget https://www.python.org/ftp/python/3.7.0/Python-3.7.0.tgz

Unzip the tarball.

tar -xzvf Python-3.7.0.tgz

Next, we need to configure the build.

./configure --enable-optimizations

This will enable a release build of the code.

The downside is that it will take a while to build because it will be running tests that will optimize the binary to run faster.

If you don't care then you can run configure without the -enable-optimizations flag.

Build Python

Next we need to build the binaries.


Once the build is done we can install the binaries.

make install

Python 3.7 is now installed.

# python3
Python 3.7.0 (default, Oct  1 2018, 13:10:35) 
[GCC 7.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.

Create a Virtual Environment

Since Python 3.3, venv has been included with Python.

To create a virtual environment, use the -m venv command line option.

$ python3 -m venv ../venv/py37test

Now you can activate the environment with:

$ source ../venv/py37test/bin/activate

You now have a Python 3.7 virtual environment.

(py37test)[email protected]:~/Development/python/py37test$ python --version 
Python 3.7.0

The virtual environment is complete with Pip version 10.0.1.

$ pip --version
pip 10.0.1 from /home/bill/Development/python/venv/py37test/lib/python3.7/site-packages/pip (python 3.7)
(py37test)[email protected]:~/Development/python/py37test$

Need more Python training?

Check out these awesome Python courses on Pluralsight. Pluralsight has great video training courses at a great price. I use Pluralsight every time I need to learn something new.


In this post, we learned how to install Python 3.7.0 on Ubuntu 18.04 /Debian 9.5.

If you liked this post then please share and comment.

big data ,python ,ubuntu ,tutorial ,python 3.7.0

Published at DZone with permission of Bill Ward , DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}