Created
November 29, 2016 22:12
-
-
Save ckandoth/f25c7469f23e63e34bee346fcb10ec29 to your computer and use it in GitHub Desktop.
Download, install, and build Python 2.7.10 in a local folder
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
# Create a folder where you want to install different Pythons, and cd into it: | |
# Note that it doesn't need to be your home folder. Put it wherever you want to maintain such software: | |
export PYTHON_BASE="$HOME/python" | |
mkdir -p $PYTHON_BASE | |
cd $PYTHON_BASE | |
# Download source tarball into a subfolder named src, and untar: | |
curl --create-dirs -L -o src/Python-2.7.10.tgz https://www.python.org/ftp/python/2.7.10/Python-2.7.10.tgz | |
cd src | |
tar -zxf Python-2.7.10.tgz | |
# Configure, build, and install into a properly versioned subdirectory: | |
cd Python-2.7.10 | |
./configure --prefix=$PYTHON_BASE/python-2.7.10 --enable-shared --enable-unicode=ucs4 LDFLAGS="-Wl,-rpath=$PYTHON_PREFIX/lib" | |
make | |
make install | |
# Make sure the latest setuptools and pip are installed: | |
$PYTHON_BASE/python-2.7.10/bin/python -m ensurepip | |
$PYTHON_BASE/python-2.7.10/bin/pip install --upgrade setuptools pip | |
# Install all the various packages we use here at MSKCC: | |
$PYTHON_BASE/python-2.7.10/bin/pip install --upgrade alabaster ansi argparse azure babel biopython drmaa filemagic fireworks fusepy ipython lockfile markerlib nose powerline-status pygments pyvcf sh snowballstemmer sphinx virtualenv wheel | |
$PYTHON_BASE/python-2.7.10/bin/pip install --upgrade pysam matplotlib pandas cython scipy |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks, that clarifies it should be nested. But...if you want multiple versions of Python installed (which is already assumed by installing Python 2), putting a version in the path will make it more maintainable (So your programs can require that version, instead of using the wrong version on a different computer or after reinstall). In other words, if that directory structure works:
export PYTHON_PREFIX=$PYTHON_BASE/python-2.7.10
afterexport PYTHON_BASE="$HOME/python"
, then:./configure --prefix=$PYTHON_PREFIX --enable-shared --enable-unicode=ucs4 LDFLAGS="-Wl,-rpath=$PYTHON_PREFIX/lib"
$PYTHON_BASE/python-2.7
forPYTHON_PREFIX
(and for-prefix
) instead, so programs can find still find it after updating Python 2 (and there probably aren't API changes between subminor versions such as between 2.7.10 and 2.7.11. If you really need to distinguish between them, you could make $PYTHON_BASE/python2 a symlink to the one you want to use for your programs).