This will resolve issues with GDAL on OS X in your virtualenv:
brew install gdal- From OUTSIDE a virtualenv (try,
deactivate), run this command to find your system site-packages directory:python -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())"- Chances are this will be
/Library/Python/2.7/site-packages - Note: this is where
pip install ...packages are placed
- Chances are this will be
- Copy the
gdal-XXX.pthfile to thesite-packagesdirectory of your virtual environment. - Find your site packages directory for your virtual env by running the earlier command,
python -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())", from inside an activated virtualenv.
Example, I use ~/Envs as my WORKON_HOME (where virtualenv creates environments), so my command would be:
cp /Library/Python/2.7/site-packages/gdal-py2.7.pth ~/Envs/rex/lib/python2.7/site-packages/gdal.pth
Now GDAL will work inside Python.
In production deployments this dependency is handled entirely inside of the Dockerfile.