-
-
Save ajmaddaford/6270075 to your computer and use it in GitHub Desktop.
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 | |
| # Source: http://toomuchdata.com/2012/06/25/how-to-install-python-2-7-3-on-centos-6-2/ | |
| # Install development tools and some misc. necessary packages | |
| yum -y groupinstall "Development tools" | |
| yum -y install zlib-devel # gen'l reqs | |
| yum -y install bzip2-devel openssl-devel ncurses-devel # gen'l reqs | |
| yum -y install readline-devel tk-devel | |
| yum -y install mysql-devel # req'd to use MySQL with python ('mysql-python' package) | |
| yum -y install libxml2-devel libxslt-devel # req'd by python package 'lxml' | |
| yum -y install unixODBC-devel # req'd by python package 'pyodbc' | |
| yum -y install sqlite sqlite-devel # you will be sad if you don't install this before compiling python, and later need it. | |
| # Alias shasum to == sha1sum (will prevent some people's scripts from breaking) | |
| echo 'alias shasum="sha1sum"' >> $HOME/.bashrc | |
| # Install Python 2.7.4 (do NOT remove 2.6, by the way) | |
| cd /tmp | |
| wget http://www.python.org/ftp/python/2.7.4/Python-2.7.4.tar.bz2 | |
| tar xf Python-2.7.4.tar.bz2 | |
| cd Python-2.7.4 | |
| ./configure --prefix=/opt/python2.7 | |
| make && make altinstall | |
| set -o vi | |
| ln -s /opt/python2.7/bin/python2.7 /usr/local/bin/python | |
| ln -s /opt/python2.7/bin/easy_install-2.7 /usr/local/bin/easy_install | |
| echo 'PATH=/usr/local/bin:$PATH' >> /home/vagrant/.bashrc | |
| echo 'export PATH' >> /home/vagrant/.bashrc | |
| # Install distribute | |
| wget --no-check-certificate http://pypi.python.org/packages/source/d/distribute/distribute-0.6.27.tar.gz | |
| tar xf distribute-0.6.27.tar.gz | |
| cd distribute-0.6.27 | |
| /usr/local/bin/python setup.py install | |
| # Install pip | |
| wget --no-check-certificate https://pypi.python.org/packages/source/p/pip/pip-1.4.1.tar.gz#md5=6afbb46aeb48abac658d4df742bff714 | |
| /usr/local/bin/easy_install pip-1.4.1.tar.gz | |
| ln -s /opt/python2.7/bin/pip-2.7 /usr/local/bin/pip | |
| # Install virtualenv and virtualenvwrapper | |
| /usr/local/bin/pip install virtualenv | |
| /usr/local/bin/pip install virtualenvwrapper | |
| ln -s /opt/python2.7/bin/virtualenv-2.7 /usr/local/bin/virtualenv | |
| ln -s /opt/python2.7/bin/virtualenvwrapper.sh /usr/local/bin/virtualenvwrapper.sh | |
| echo 'export WORKON_HOME=/home/vagrant/.virtualenvs' >> /home/vagrant/.bashrc # Change this directory if you don't like it | |
| runuser -l vagrant -c 'mkdir -p /home/vagrant/.virtualenvs' | |
| echo '. /usr/local/bin/virtualenvwrapper.sh' >> /home/vagrant/.bashrc | |
| # Done! | |
| # Now you can do: `mkvirtualenv foo --python=python2.7` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment