Last active
August 29, 2015 14:01
-
-
Save RexGibson/73f4aa8a01cdc9c99690 to your computer and use it in GitHub Desktop.
Link Numpy and Scipy to a virtual env
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 | |
if [[ -z $1 ]] | |
then | |
echo "must supply virtualenvname" | |
exit 128 | |
fi | |
# This lists the packages to link from the system site packages | |
PACKAGES_TO_INSTALL=(numpy scipy) | |
virtual_site_packages=/opt/virtualenvs/${1}/lib/python2.7/site-packages | |
# Set up the packages in arr | |
for pkg in ${PACKAGES_TO_INSTALL[*]} | |
do | |
global_pkg=`python -c "import ${pkg}; import os; import sys; sys.stdout.write(os.path.split(${pkg}.__file__)[0])"` | |
virtual_pkg=$virtual_site_packages/$pkg | |
if [ -e "$global_pkg" ] | |
then | |
ln -sf $global_pkg $virtual_pkg | |
else | |
echo "Package $pkg was not installed on the system. Aborting." | |
exit 1 | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment