DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports Events Over 2 million developers have joined DZone. Join Today! Thanks for visiting DZone today,
Edit Profile Manage Email Subscriptions Moderation Admin Console How to Post to DZone Article Submission Guidelines
View Profile
Sign Out
Refcards
Trend Reports
Events
Zones
Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
  1. DZone
  2. Coding
  3. Frameworks
  4. Install Python 3.7.0 on Ubuntu 18.04/Debian 9.5

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!

Bill Ward user avatar by
Bill Ward
·
Oct. 03, 18 · Tutorial
Like (3)
Save
Tweet
Share
53.94K Views

Join the DZone community and get the full member experience.

Join For Free

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.

Preparations

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.

make

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.

Conclusion

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.

Python (language) ubuntu

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

Opinions expressed by DZone contributors are their own.

Popular on DZone

  • Apache NiFi Overview
  • Real-Time Stream Processing With Hazelcast and StreamNative
  • Building Angular Library and Publishing in npmjs Registry
  • How to Use MQTT in Java

Comments

Partner Resources

X

ABOUT US

  • About DZone
  • Send feedback
  • Careers
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 600 Park Offices Drive
  • Suite 300
  • Durham, NC 27709
  • support@dzone.com
  • +1 (919) 678-0300

Let's be friends: