brew 在哪里安装 Python headers?
Where does brew install the Python headers?
我正在尝试在 Cython 中编译一个简单的 "Hello, World!"。在我的文件中:
print("Hello, World!")
我运行:
cython hello_world.pyx
获取hello_world.c
文件。然后我尝试:
gcc -c hello_world.c
给出错误:
fatal error: 'Python.h' file not found
然后我试了this:
gcc -c hello_world.c -framework Python
没用。我将 include "Python.h"
更改为 <Python/Python.h>
并得到了不同的错误:
fatal error: 'longintrepr.h' file not found
无论如何,我想使用 Python3,而不是 Apple 附带的 Python,但我无法弄清楚 Python3 开发 headers 的位置.
最终,我希望能够编译 hello_world.c
以便它在 Python3 解释器中工作。
(我正在使用 brew 的 python3.5.2_1,如果有帮助的话。)
离开@sr3z 的评论,做:
gcc -c random_sum.c -I/usr/local/Cellar/python3/3.5.2_1/Frameworks/Python.framework/Versions/3.5/include/python3.5m
创建random_sum.o
。
目前是/usr/local/Frameworks/Python.framework/Headers
。
我正在尝试在 Cython 中编译一个简单的 "Hello, World!"。在我的文件中:
print("Hello, World!")
我运行:
cython hello_world.pyx
获取hello_world.c
文件。然后我尝试:
gcc -c hello_world.c
给出错误:
fatal error: 'Python.h' file not found
然后我试了this:
gcc -c hello_world.c -framework Python
没用。我将 include "Python.h"
更改为 <Python/Python.h>
并得到了不同的错误:
fatal error: 'longintrepr.h' file not found
无论如何,我想使用 Python3,而不是 Apple 附带的 Python,但我无法弄清楚 Python3 开发 headers 的位置.
最终,我希望能够编译 hello_world.c
以便它在 Python3 解释器中工作。
(我正在使用 brew 的 python3.5.2_1,如果有帮助的话。)
离开@sr3z 的评论,做:
gcc -c random_sum.c -I/usr/local/Cellar/python3/3.5.2_1/Frameworks/Python.framework/Versions/3.5/include/python3.5m
创建random_sum.o
。
目前是/usr/local/Frameworks/Python.framework/Headers
。