Forked from andriisoldatenko/install_python.sh
Last active
September 21, 2015 08:04
-
-
Save firstval/d2a96d3be97c23a99696 to your computer and use it in GitHub Desktop.
Install local Python 2.7.10 on CentOS 7
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
TMP_PATH=~/tmp_install_python | |
#Install python3-tk and tk-dev | |
sudo aptitude install python3-tk | |
sudo aptitude install tk-dev | |
# Versions section | |
PYTHON_MAJOR=2.7 | |
PYTHON_VERSION=$PYTHON_MAJOR.10 | |
mkdir $TMP_PATH && cd $TMP_PATH | |
# Update yum and libraries | |
yum -y update | |
yum groupinstall -y development | |
yum install python-tools.x86_64 | |
yum install tk tk-devel tcl tcl-devel | |
yum install -y zlib-dev openssl-devel sqlite-devel bzip2-devel | |
yum install xclock | |
# Download and extract Python and Setuptools | |
wget --no-check-certificate https://www.python.org/ftp/python/$PYTHON_VERSION/Python-$PYTHON_VERSION.tgz | |
wget --no-check-certificate https://bitbucket.org/pypa/setuptools/raw/bootstrap/ez_setup.py | |
wget --no-check-certificate https://raw.githubusercontent.com/pypa/pip/master/contrib/get-pip.py | |
tar -zxvf Python-$PYTHON_VERSION.tgz | |
# Compile Python | |
cd $TMP_PATH/Python-$PYTHON_VERSION | |
./configure --prefix=/usr/local | |
make && make altinstall | |
export PATH="/usr/local/bin:$PATH" | |
# Install Setuptools and PIP | |
cd $TMP_PATH | |
/usr/local/bin/python$PYTHON_MAJOR ez_setup.py | |
/usr/local/bin/python$PYTHON_MAJOR get-pip.py | |
# Finish installation | |
rm -rf $TMP_PATH | |
ln -s /usr/local/bin/python2.7 /usr/local/bin/python | |
ln -s /usr/local/bin/pip /usr/bin/pip | |
pip install virtualenv | |
#How to uninstall | |
make uninstall |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment