Installing Python from source (Ubuntu)
Get the link for the source code from the Python Software Foundation.
Run the following in the terminal.
1
2
3
4
5
6
7
8
9
10
11
12
sudo apt update
sudo apt install build-essential \
zlib1g-dev libncurses5-dev libgdbm-dev \
libnss3-dev libssl-dev libreadline-dev \
libffi-dev wget
cd /tmp
wget https://www.python.org/ftp/python/3.7.4/Python-3.7.4.tgz
tar -xvf Python-3.7.4.tgz
cd Python-3.7.4
sudo ./configure --enable-optimizations --with-openssl=/usr/bin/openssl
sudo make altinstall -j `nproc`
Sidenotes:
- Linking OpenSSL just in case
pip
can’t find it nproc
outputs the number of processors in the computer
For in-depth discussion check this source: Linuxize.
This post is licensed under CC BY 4.0 by the author.