Skip to content

Instantly share code, notes, and snippets.

@basaks
Last active September 6, 2024 08:19
Show Gist options
  • Save basaks/652eea861a143a9b3d11805c96273488 to your computer and use it in GitHub Desktop.
Save basaks/652eea861a143a9b3d11805c96273488 to your computer and use it in GitHub Desktop.
Install python3.9 on ubuntu 18.04
## Install Python3.9 interpreter on ubuntu 18.04
[From here](http://devmartin.com/blog/2016/04/creating-a-virtual-environment-with-python3.4-on-ubuntu-16.04-xenial-xerus/), we can pretty much follow the exact same procedure.
Only this I needed to on top of that blog was the `libffi-dev` system dependency.
On a terminal just do the following steps:
Install dependencies:
sudo apt install build-essential checkinstall libreadline-gplv2-dev \
libncursesw5-dev libssl-dev libsqlite3-dev tk-dev libgdbm-dev libc6-dev \
libbz2-dev openssl libffi-dev
Download and untar the desired version:
mkdir -p $HOME/opt
cd $HOME/opt
curl -O https://www.python.org/ftp/python/3.9.2/Python-3.9.2.tgz
tar -xzf Python-3.9.2.tgz
Install python3.9 while keeping python3.8 as the default python3 version on ubuntu 18.04.
cd Python-3.9.2/
./configure --enable-shared --enable-optimizations --prefix=/usr/local LDFLAGS="-Wl,--rpath=/usr/local/lib"
sudo make altinstall
Check it was installed properly:
>> python3.9 -V
Python 3.9.2
Enjoy!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment