Created
November 4, 2019 07:51
-
-
Save kenshin17/6b07052e059d3121497368ea88ad7c8c to your computer and use it in GitHub Desktop.
Compile python-3.6.5
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 | |
# File : compile-python-3.6.5.sh | |
# OS : Redhat/Debian | |
# LastUpdate : 14:38 2019.11.04 | |
# Description : Compile python-3.6.5 | |
########################################### | |
# Determine OS platform | |
echo -e "\n########## Determine OS platform ##########" | |
if [ -f /etc/redhat-release ]; then | |
# For yum-based systems (like CentOS) | |
sudo yum -y groupinstall development | |
sudo yum -y install zlib-devel | |
fi | |
if [ -f /etc/lsb-release ]; then | |
# For apt-based systems (like Debian, Ubuntu, and Mint) | |
sudo apt-get install -y make build-essential libssl-dev zlib1g-dev libbz2-dev libreadline-dev libsqlite3-dev wget curl llvm libncurses5-dev libncursesw5-dev xz-utils tk-dev | |
fi | |
# Download Python 3.6 | |
echo -e "\n########## Download Python 3.6 ##########" | |
mkdir -p /opt/setup/python3.6/ | |
cd /opt/setup/python3.6/ | |
wget https://www.python.org/ftp/python/3.6.5/Python-3.6.5.tgz | |
# Compile python 3.6 | |
echo -e "\n########## Compile python 3.6 ##########" | |
tar xvf Python-3.6.5.tgz | |
cd Python-3.6.5 | |
./configure --enable-optimizations --with-ensurepip=install | |
make -j 8 | |
make altinstall | |
# Check Result | |
echo -e "\n########## Check Result ##########" | |
/usr/local/bin/python3.6 -V | |
# Install Pip | |
echo -e "\n########## Install Pip ##########" | |
curl https://bootstrap.pypa.io/get-pip.py -o /opt/setup/python3.6/get-pip.py | |
/usr/local/bin/python3.6 /opt/setup/python3.6/get-pip.py | |
/usr/local/bin/pip3.6 -V |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment