Created
March 28, 2020 22:00
-
-
Save nockstarr/7943e742f317f4fae008f7c685f4de2b to your computer and use it in GitHub Desktop.
install python 3.7xx || 3.8xx
This file contains hidden or 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
#!/bin/bash | |
set -e | |
python_version=3.8.2 | |
read -p $'Type Python version ex 3.8.2 \n' python_version | |
[ -z $python_version ] && echo "missing verison" && exit | |
echo "You selected python version $python_version" | |
read -p "Continioue? [y/N] " proceed_install | |
[[ $proceed_install != "Y" && $proceed_install != "y" ]] && exit | |
[ -d "/opt/python-$python_version" ] && echo "Directory /opt/python-$python_version exists..." && exit | |
echo "[x] Installing Python version $python_version" | |
echo "[x] Installing dependencies.." | |
sudo apt install python3-pip python3-dev build-essential zlib1g-dev libncurses5-dev libgdbm-dev libnss3-dev libssl-dev libreadline-dev libffi-dev wget | |
echo "[x] Downloading..." | |
cd /home/"$USER"/Downloads | |
wget https://www.python.org/ftp/python/$python_version/Python-$python_version.tar.xz | |
tar xf Python-$python_version.tar.xz | |
cd Python-$python_version | |
ls -la | |
sudo ./configure --enable-optimizations --with-ensurepip=install --prefix=/opt/python-$python_version | |
sudo make -j 8 | |
sudo make altinstall | |
echo "[x] Done Installing Python $python_version from source" | |
echo "# Python-$python_version" >> /home/"$USER"/.bashrc | |
echo "export PATH=/opt/python-$python_version/bin:\$PATH" >> /home/"$USER"/.bashrc | |
echo "[x] Added Python $python_version to path" | |
echo "[x] All DOne!" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment