use*_*255 6 c python numpy makefile include
请问什么是如何确定numpy正确路径的最简单/最优雅的方法,因为它们存在于目标系统中?然后通过make命令使用它?目前我正在使用
gcc ... -I/usr/include/python2.7/-I/usr/lib/python2.7/site-packages/numpy/core/include/numpy /
我想让这两个包括根据构建所在的系统自动选择.
好像我可以得到第二个这样的包括:
python -c "import numpy; print numpy.__path__[0] + 'core/include/numpy/'"
Run Code Online (Sandbox Code Playgroud)
但我不确定第一个,即使我是,我仍然不确定如何最好地使用它来自makefile(以简单/优雅的方式)
因此,经过一番谷歌搜索和实验后,我得出了以下结论:
CFLAGS = $(shell python-config --includes) $(shell python -c "import numpy; print '-I' + numpy.__path__[0] + '/core/include/numpy/'")
Run Code Online (Sandbox Code Playgroud)
不确定它有多可靠,但到目前为止它似乎适用于所有机器。
我必须使用 $(shell ...) 从 shell 输出设置 make 变量,因为 mux 提出的方法对我不起作用