/ python

Upgrading Python on Debian

Python is insanely versatile. Likely, if you're reading this, you already know about Python and what it's capable of. However, you're likely using Python 3.5 if you're running any sort of Debian or Ubuntu LTS. Python 3.7 offers a slew of new features that are enticing for systems and web developers, such as debugging, new reserved words, and potential performance gains.

The first thing you will want to do is make sure all of the necessary components are installed:

sudo apt install build-essential zlib1g-dev libreadline-gplv2-dev libncursesw5-dev libssl-dev libsqlite3-dev tk-dev libgdbm-dev libc6-dev libbz2-dev

Once that is installed, pull the latest version of Python 3.7 (3.7.2 at the time of this writing).

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

Now we're going to extract the contents and build the source.

tar -xvf Python-3.7.2.tgz
cd Python-3.7.2
./configure
make
sudo make install

After that's done, drop out of your shell with exit or close out how you normally do. Once you start a new session, the new path will be set and you'll be able to get to work with Python 3.7.

Note, this also works on Windows Subsystem for Linux and Ubuntu. So, go ahead and get to work!

pip install --user django psycopg2

Minor WSL note

The command 'django-admin' was installed at ~/.local/bin which wasn't part of my path. I added

export PATH=~/.local/bin:$PATH

to my ~/.bashrc file and soured the file before starting my Django project.

Let me know if you have any questions. Thanks for reading!

Upgrading Python on Debian
Share this