Last active
December 23, 2015 10:59
-
-
Save gotgenes/6624963 to your computer and use it in GitHub Desktop.
Install setuptools, pip, and virtualenvwrapper for OS X.
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
#!/bin/bash | |
set -e | |
set -u | |
PYTHON_VERSION='2.7' # Change this value if you use a different version of python, e.g., 3.3 | |
PYTHON="python${PYTHON_VERSION}" | |
PIP="pip-${PYTHON_VERSION}" | |
echo "Installing most recent version of setuptools." | |
sudo bash -c 'curl https://bitbucket.org/pypa/setuptools/raw/bootstrap/ez_setup.py | "${PYTHON}"' | |
echo "Installing most recent version of pip." | |
sudo bash -c 'curl https://raw.github.com/pypa/pip/master/contrib/get-pip.py | "${PYTHON}"' | |
USER_SITE_PACKAGES_BIN="${HOME}/Library/Python/${PYTHON_VERSION}/bin" | |
echo "Adding ${USER_SITE_PACKAGES_BIN} to your PATH." | |
cat <<'EOF' >> "${HOME}/.bashrc" | |
# Python user site packages bin | |
export PATH="${USER_SITE_PACKAGES_BIN}:\${PATH}" | |
EOF | |
echo "Installing virtualenv and virtualenvwrapper." | |
sudo ${PIP} install virtualenvwrapper | |
VIRTUALENVS_DIR="${HOME}/.virtualenvs" | |
echo "Making virtualenvs dir at ${VIRTUALENVS_DIR}." | |
mkdir -p "${VIRTUALENVS_DIR}" | |
echo "Adding WORKON_HOME." | |
cat << EOF >> "${HOME}/.bashrc" | |
export WORKON_HOME="\${HOME}/.virtualenvs" | |
VIRTUALENVWRAPPER_PATH="/usr/local/bin/virtualenvwrapper.sh" | |
if [ -f \$VIRTUALENVWRAPPER_PATH ]; then | |
source \$VIRTUALENVWRAPPER_PATH | |
fi | |
EOF | |
echo "All done." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment