In this tutorial, we will show you how to install and configure Python 3 on Debian 8. For those of you who didn’t know, Python is an open-source and beginner-friendly programming language. Debian 7 and Debian 8 come with two versions of Python, Python 2.7 and Python 3.5. At the time of this writing, the latest stable version of Python is 3.6, released on Mar 21rd, 2017. If you need to use python 3 as part of Python application dependency, there are several ways to install python3 on Debian 8.
This article assumes you have at least basic knowledge of Linux, know how to use the shell, and most importantly, you host your site on your own VPS. The installation is quite simple and assumes you are running in the root account, if not you may need to add ‘sudo
‘ to the commands to get root privileges. I will show you the step-by-step installation of Python 3 on a Debian 8 (Jessie) server.
Prerequisites
- A server running one of the following operating systems: Debian 8 (Jessie).
- It’s recommended that you use a fresh OS install to prevent any potential issues.
- SSH access to the server (or just open Terminal if you’re on a desktop).
- A
non-root sudo user
or access to theroot user
. We recommend acting as anon-root sudo user
, however, as you can harm your system if you’re not careful when acting as the root.
Install Python 3 on Debian 8 Jessie
Step 1. Before we install any software, it’s important to make sure your system is up to date by running the following apt-get
commands in the terminal:
sudo apt-get update sudo apt-get upgrade
Step 2. Installing Python 3.
First, we need to install some build dependencies using the commands below:
sudo apt install build-essential checkinstall sudo apt install libreadline-gplv2-dev libncursesw5-dev libssl-dev libsqlite3-dev tk-dev libgdbm-dev libc6-dev libbz2-dev
Then, download Python 3.6 packages from the source:
wget https://www.python.org/ftp/python/3.6.1/Python-3.6.1.tar.xz tar xvf Python-3.6.1.tar.xz
Now cd into the source directory, configure the built environment, and install:
cd Python-3.6.1/ ./configure sudo make altinstall
Once the process is complete, check the version of Python 3:
python3 --version
Congratulations! You have successfully installed Python. Thanks for using this tutorial for installing Python 3 on your Debian 8 system. For additional help or useful information, we recommend you check the official Python website.