Skip to content

Commit

Permalink
Fix Python version in Ubuntu18
Browse files Browse the repository at this point in the history
  • Loading branch information
amanr032@gmail.com authored and amanr032@gmail.com committed Feb 10, 2023
1 parent e0290fd commit 4624b74
Showing 1 changed file with 26 additions and 1 deletion.
27 changes: 26 additions & 1 deletion installer/install_dependencies.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,28 @@
#!/bin/bash

#Upgrade Python if version is below than 3.8.10
function upgradePython {
if $(dpkg --compare-versions $(python3 -c 'import sys; print(".".join(map(str, sys.version_info[:3])))') "lt" "3.8.10"); then
echo Intalling dependencies
sudo apt-get install -y make build-essential libssl-dev zlib1g-dev \
libbz2-dev libreadline-dev libsqlite3-dev llvm \
libncursesw5-dev xz-utils tk-dev libxml2-dev libxmlsec1-dev libffi-dev liblzma-dev

if command -v pyenv 1; then
echo pyenv available
else
echo Downloading pyenv
curl https://pyenv.run | bash
export PATH="$HOME/.pyenv/bin:$PATH" && eval "$(pyenv init --path)" && echo -e 'export PATH="$HOME/.pyenv/bin:$PATH"\nif command -v pyenv 1>/dev/null 2>&1; then\n eval "$(pyenv init -)"\nfi' >> ~/.bashrc
echo Restarting shell
fi
echo Start Python upgrade
pyenv install 3.8.10
pyenv global 3.8.10
echo Finish Python upgrade
fi
}

# Install dependencies
echo Installing dependencies
sudo apt-get install -y make curl wget libltdl7 libseccomp2 libffi-dev gawk apt-transport-https ca-certificates curl gnupg gnupg-agent lsb-release software-properties-common sshpass pv
Expand All @@ -16,8 +39,9 @@ echo \
echo Updating local repositories
sudo apt-get update

# Install python dependencies
# Install pydthon dependencies
echo Installing Python dependencies
upgradePython
sudo apt-get install -y python3-distutils
sudo apt-get install -y python3-pip
python3 -m pip install -U pip setuptools
Expand All @@ -40,3 +64,4 @@ fi

# Ensure /usr/local/bin is in path
export PATH=$PATH:/usr/local/bin
exec $SHELL

0 comments on commit 4624b74

Please sign in to comment.