# update system
sudo apt update && sudo apt upgrade -y
# install build tools and python prerequisites
sudo apt install build-essential libssl-dev zlib1g-dev libncurses5-dev libncursesw5-dev libreadline-dev libsqlite3-dev libgdbm-dev libdb5.3-dev libbz2-dev libexpat1-dev liblzma-dev tk-dev libffi-dev
# download and extract python
wget https://www.python.org/ftp/python/3.7.0/Python-3.7.0.tar.xz
tar xf Python-3.7.0.tar.xz
cd Python-3.7.0
# build python
./configure --enable-optimizations
# 'make -j <x>' enables parallel execution of <x> make recipes simultaneously
sudo make -j 8
# altinstall does not alter original system python install
sudo make altinstall
# run python3.7 when you type python3
sudo update-alternatives --install /usr/bin/python3 python3 /usr/local/bin/python3.7 1
sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.6 2
# run below and select python3.7 from the list
sudo update-alternatives --config python3
# or create a shortcut
sudo ln -s /usr/local/bin/python3.7 /usr/bin/py
Created
October 25, 2022 13:33
-
-
Save siteslave/4d8493f2ad4c6ae276f4ebb50d05b8c1 to your computer and use it in GitHub Desktop.
Installing Python 3.7 from source on Ubuntu 18.04
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
python -m venv my-env source my-env/bin/activate python -m pip install jupyterlab