Skip to content

Instantly share code, notes, and snippets.

@rtluckie
Last active August 29, 2015 14:02
Show Gist options
  • Save rtluckie/28dfbe984cf82c7914cb to your computer and use it in GitHub Desktop.
Save rtluckie/28dfbe984cf82c7914cb to your computer and use it in GitHub Desktop.
Install Python CentOS, Fedora
# Install requirements
VERSION=2.6.9
VERSION_SHORT=2.6
mkdir /tmp/python-install
cd /tmp/python-install
wget https://www.python.org/ftp/python/${VERSION}/Python-${VERSION}.tar.xz
tar xf Python-${VERSION}.tar.xz
cd Python-${VERSION}
./configure --prefix=/usr/local --enable-unicode=ucs4 --enable-shared LDFLAGS="-Wl,-rpath /usr/local/lib"
sudo make && sudo make altinstall
cd /tmp/python-install
wget https://bitbucket.org/pypa/setuptools/raw/bootstrap/ez_setup.py
python${VERSION_SHORT} ez_setup.py
easy_install-${VERSION_SHORT} pip
pip${VERSION_SHORT} install virtualenvwrapper
if [ ! -d $HOME/.venvs ]; then
mkdir ~/.venvs
fi
# Add content of pythonrc
#Create base virtualenv
mkvirtualenv -p python-${VERSION_SHORT} base${VERSION_SHORT}
# to deactivate virtualenv
deactivate
# to activate at a later time
workon base${VERSION_SHORT}
# Install requirements
VERSION=2.7.8
VERSION_SHORT=2.7
if [ -d /tmp/python-install ]; then
rm -fr /tmp/python-install/*
fi
if [ ! -d /tmp/python-install ]; then
mkdir /tmp/python-install
fi
cd /tmp/python-install
wget http://python.org/ftp/python/${VERSION}/Python-${VERSION}.tar.xz
tar xf Python-${VERSION}.tar.xz
cd Python-${VERSION}
./configure --prefix=/usr/local --enable-unicode=ucs4 --enable-shared LDFLAGS="-Wl,-rpath /usr/local/lib"
sudo make && sudo make altinstall
cd /tmp/python-install
wget https://bitbucket.org/pypa/setuptools/raw/bootstrap/ez_setup.py
python${VERSION_SHORT} ez_setup.py
#cleanup
rm -fr /tmp/python-install
easy_install-${VERSION_SHORT} pip
pip${VERSION_SHORT} install virtualenvwrapper
if [ ! -d $HOME/.venvs ]; then
mkdir ~/.venvs
fi
# Add content of pythonrc
#Create base virtualenv
mkvirtualenv -p python-${VERSION_SHORT} base${VERSION_SHORT}
# to deactivate virtualenv
deactivate
# to activate at a later time
workon base${VERSION_SHORT}
# Install requirements
VERSION=3.4.2
VERSION_SHORT=3.4
wget http://python.org/ftp/python/${VERSION}/Python-${VERSION}.tar.xz
tar xf Python-${VERSION}.tar.xz
cd Python-${VERSION}
./configure --prefix=/usr/local --enable-shared LDFLAGS="-Wl,-rpath /usr/local/lib"
sudo make && sudo make altinstall
cd /tmp/python-install
wget https://bitbucket.org/pypa/setuptools/raw/bootstrap/ez_setup.py
python${VERSION_SHORT} ez_setup.py
#cleanup
rm -fr /tmp/python-install
# virtualenvs are a bit different in python 3.4 see https://docs.python.org/3/library/venv.html
# make sure the following values are in your shells profile/rc file (.bashrc, .profile, or .zshrc)
export PATH=/usr/local/bin:$PATH
export WORKON_HOME=$HOME/.venvs
export PROJECT_HOME=$HOME/projects
export VIRTUALENVWRAPPER_SCRIPT=/usr/local/bin/virtualenvwrapper.sh
source /usr/local/bin/virtualenvwrapper_lazy.sh
# CentOS
sudo yum groupinstall "Development tools"
sudo yum install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gdbm-devel db4-devel libpcap-devel xz-devel
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment