Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Setup pyximport to include the numpy headers
import pyximport
import numpy as np
pyximport.install(setup_args={'include_dirs': np.get_include()})
@rmcgibbo

This comment has been minimized.

Copy link

rmcgibbo commented Mar 17, 2013

Thanks!

@standy66

This comment has been minimized.

Copy link

standy66 commented Nov 19, 2016

Thanks

@mosco

This comment has been minimized.

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

This comment has been minimized.

Copy link

dineshadepu commented Jul 10, 2017

Thanks

@chbrandt

This comment has been minimized.

Copy link

chbrandt commented Feb 5, 2018

Awesome. Thanks

@danelee2601

This comment has been minimized.

Copy link

danelee2601 commented Jul 6, 2018

Awesome :) Thanks a lot

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.