Last active
February 8, 2023 16:22
-
-
Save UbuntuEvangelist/e7b77cdf52b286a523280eb035c33665 to your computer and use it in GitHub Desktop.
Managing Multiple Versions of Python on Ubuntu 20.04
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Managing Multiple Versions of Python on Ubuntu 20.04 | |
sudo apt update | |
sudo apt install build-essential zlib1g-dev libncurses5-dev libgdbm-dev libnss3-dev libssl-dev libreadline-dev libffi-dev libsqlite3-dev wget libbz2-dev | |
sudo apt-get install build-essential checkinstall | |
sudo apt autoremove | |
sudo apt-get install libreadline-gplv2-dev libncursesw5-dev libssl-dev libsqlite3-dev tk-dev libgdbm-dev libc6-dev libbz2-dev libffi-dev zlib1g-dev | |
sudo apt-get install build-essential checkinstall | |
sudo apt-get install libreadline-gplv2-dev libncursesw5-dev libssl-dev \ | |
libsqlite3-dev tk-dev libgdbm-dev libc6-dev libbz2-dev libffi-dev zlib1g-dev | |
cd /opt | |
sudo wget https://www.python.org/ftp/python/3.9.2/Python-3.9.2.tgz | |
sudo tar xzf Python-3.9.2.tgz | |
cd Python-3.9.2 | |
sudo ./configure --enable-optimizations | |
sudo make altinstall | |
cd /usr/local/bin/ | |
ls | |
update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.8 1 | |
update-alternatives --install /usr/bin/python3 python3 /usr/local/bin/python3.9 2 | |
update-alternatives --list python3 | |
update-alternatives --config python3 | |
sudo apt-get install python3-pip | |
sudo nano ~/.bashrc | |
# Add into the bottom | |
alias python=python3 | |
alias pip=pip3 | |
# Save & Exit ctrl+s and ctrl+x | |
alias python=python3 | |
alias pip=pip3 | |
source ~/.bashrc | |
sudo apt update -y | |
sudo apt upgrade -y | |
python3 --version | |
python --version | |
pip3 --version | |
pip --version | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment