Last active
December 23, 2015 04:39
-
-
Save webee/6581853 to your computer and use it in GitHub Desktop.
setup python environment: python2.7.5,easy_install, pip, virtualenv, ipython.#curl https://gist.githubusercontent.com/webee/6581853/raw/pyenv.sh |sudo sh
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/sh | |
| #curl https://gist.githubusercontent.com/webee/6581853/raw/pyenv.sh |sudo sh | |
| #set -x | |
| #resource url. | |
| #check root. | |
| root=$(whoami) | |
| if [ "$root" != "root" ];then | |
| echo "need root privilege." | |
| exit 1 | |
| fi | |
| PY_VER=2.7.6 | |
| PY_DIR=Python-${PY_VER} | |
| PY_PROFILE_URL=https://gist.githubusercontent.com/webee/6582040/raw/python.sh | |
| PY_PROFILE=/etc/profile.d/python.sh | |
| PY_SRC_URL=http://www.python.org/ftp/python/${PY_VER}/${PY_DIR}.tar.bz2 | |
| PY_SETUPTOOLS_URL=https://bitbucket.org/pypa/setuptools/raw/bootstrap/ez_setup.py | |
| #download resources. | |
| function download_resources() { | |
| cd $PY_ROOT | |
| mkdir -p src | |
| cd src | |
| wget $PY_SRC_URL | |
| } | |
| #extract resources. | |
| function extract_resources() { | |
| cd ${PY_ROOT} | |
| mkdir -p xsrc | |
| cd xsrc | |
| tar xf ${PY_SRC}/${PY_DIR}.tar.bz2 | |
| } | |
| #install python | |
| function install_python() { | |
| cd ${PY_DIR} | |
| ./configure --prefix=${PY_ROOT}/${PY_DIR} | |
| make | |
| make install | |
| cd ${PY_ROOT} | |
| ln -s ${PY_DIR} default | |
| } | |
| #install setuptools | |
| function install_setuptools() { | |
| wget ${PY_SETUPTOOLS_URL} -O -|${PY_HOME}/bin/python | |
| } | |
| #install pip | |
| function install_pip() { | |
| $PY_HOME/bin/easy_install pip | |
| } | |
| #install virtualenv | |
| function install_virtualenv() { | |
| #repo: http://e.pypi.python.org/ | |
| $PY_HOME/bin/pip install virtualenv -i http://pypi.v2ex.com/simple | |
| } | |
| #do | |
| curl $PY_PROFILE_URL >$PY_PROFILE | |
| source $PY_PROFILE | |
| mkdir -p $PY_ROOT | |
| download_resources | |
| extract_resources | |
| install_python | |
| install_setuptools | |
| install_pip | |
| install_virtualenv | |
| setup_pyenv $PY_DEFAULT_ENV | |
| #active default pyenv | |
| pyenv | |
| #install essential tools/libs. | |
| pipinstall ipython | |
| #pipinstall numpy | |
| #pipinstall Cython |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment