Skip to content

Instantly share code, notes, and snippets.

@hannes-brt
Created December 28, 2010 13:08
Show Gist options
  • Star 17 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hannes-brt/757191 to your computer and use it in GitHub Desktop.
Save hannes-brt/757191 to your computer and use it in GitHub Desktop.
Setup pyximport to include the numpy headers
import pyximport
import numpy as np
pyximport.install(setup_args={'include_dirs': np.get_include()})
@rmcgibbo
Copy link

Thanks!

@standy66
Copy link

Thanks

@mosco
Copy link

mosco commented Jun 2, 2017

Note that this does not work on OS X with home-brewed python, since home-brew overrides the include_dirs parameter in /usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/distutils.cfg

Another method like globally setting CFLAGS should be used. i.e. adding this to ~/.bash_profile:
export CFLAGS="-I/usr/local/lib/python2.7/site-packages/numpy/core/include/"

@dineshadepu
Copy link

Thanks

@chbrandt
Copy link

chbrandt commented Feb 5, 2018

Awesome. Thanks

@danelee2601
Copy link

Awesome :) Thanks a lot

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment