Last active
June 26, 2024 11:07
-
-
Save dameyerdave/db2e2e97a92d3911017fc4378c8f2bf7 to your computer and use it in GitHub Desktop.
Install Python 3.10 on RHEL/CENTOS
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
#!/usr/bin/env bash | |
sudo dnf install wget yum-utils make gcc openssl-devel bzip2-devel libffi-devel zlib-devel | |
# Ubuntu: sudo apt install -y wget yum-utils make gcc libssl-dev libbz2-dev libffi-dev zlib1g-dev | |
mkdir tmp | |
cd tmp | |
wget https://www.python.org/ftp/python/3.10.8/Python-3.10.8.tgz | |
tar xzf Python-3.10.8.tgz | |
cd Python-3.10.8 | |
sudo ./configure --with-system-ffi --with-computed-gotos --enable-loadable-sqlite-extensions --enable-optimizations --enable-shared | |
sudo make -j $(nproc) | |
# to remove the unused stuff: find . -maxdepth 1 -mtime +1 -exec rm -rf {} \; | |
# to install pip we can use: python -m ensurepip --upgrade | |
# it will install pip into $HOME/.local/bin | |
sudo make altinstall | |
sudo rm Python-3.10.8.tgz | |
sudo update-alternatives --install /usr/bin/python3 python3 /usr/local/bin/python3.10 1 | |
sudo update-alternatives --set python3 /usr/local/bin/python3.10 | |
sudo rm -rf /usr/local/bin/pip3 | |
sudo update-alternatives --install /usr/bin/pip3 pip3 /usr/local/bin/pip3.10 1 | |
sudo update-alternatives --set pip3 /usr/local/bin/pip3.10 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
sudo update-alternatives --install /usr/bin/pip3 pip3 /usr/local/bin/pip3.10 1
failed to link /usr/bin/pip3 -> /etc/alternatives/pip3: /usr/bin/pip3 exists and it is not a symlink
(kubespray-venv) [root@tuxmail-labtech Python-3.10.8]# sudo ln -s /usr/local/bin/pip3.10 /usr/bin/pip3
ln: falha ao criar link simbólico '/usr/bin/pip3': Arquivo existe
(kubespray-venv) [root@tuxmail-labtech Python-3.10.8]# sudo rm /usr/bin/pip3
(kubespray-venv) [root@tuxmail-labtech Python-3.10.8]# sudo ln -s /usr/local/bin/pip3.10 /usr/bin/pip3
(kubespray-venv) [root@tuxmail-labtech Python-3.10.8]# sudo update-alternatives --install /usr/bin/pip3 pip3 /usr/local/bin/pip3.10 1