我正在按照本教程学习如何使用C\C++代码扩展Python.
名为"使用GCC for Microsoft Windows构建扩展模块"的部分对我失败,出现以下错误:
fatal error: Python.h: No such file or directory
Run Code Online (Sandbox Code Playgroud)
名为"使用Microsoft Visual C++构建扩展模块"的部分也失败,但出现类似的错误:
fatal error C1083: Cannot open include file: 'Python.h': No such file or directory
Run Code Online (Sandbox Code Playgroud)
我该怎么做才能解决这个问题?
我正在尝试按照本教程编译一个简单的python/C示例:
http://www.swig.org/tutorial.html
我在MacOS上使用Anaconda python.
但是,当我跑
gcc -c example.c example_wrap.c -I/Users/myuser/anaconda/include/
Run Code Online (Sandbox Code Playgroud)
我明白了:
example_wrap.c:130:11: fatal error: 'Python.h' file not found
# include <Python.h>
^
Run Code Online (Sandbox Code Playgroud)
似乎在一些问题中报告了这个问题:
但似乎没有一个在MacOS上提供Anaconda特有的答案
有人解决了吗?