Mar*_*ton 6 c python gcc cython
我一直在使用Cython将我的Python文件编译成C文件,然后使用MinGW从C文件创建可执行文件.Cython工作正常,我可以输入cython test.pyx命令行并获得一个C文件.问题是当我尝试从C文件编译可执行文件时.如果我输入,gcc test.c我会收到以下错误:
test.c:4:20: fatal error: Python.h: No such file or directory
#include "Python.h"
^
compilation terminated.
Run Code Online (Sandbox Code Playgroud)
我真的很感激一些帮助.我正在运行Windows 7和python 3.5.
bru*_*ceg 13
你可能没有安装python-dev.根据您的操作系统,您需要执行以下操作:
sudo apt-get install python-dev
Run Code Online (Sandbox Code Playgroud)
这是你在Ubuntu上做的
小智 5
在gcc
#include "file.h"
Run Code Online (Sandbox Code Playgroud)
告诉gcc在test.c所在的同一目录中找到该文件
#include <file.h>
Run Code Online (Sandbox Code Playgroud)
意味着在gcc包含路径中查找file.h,可以使用-I添加
gcc -I/path/to/the/file_h test.c
Run Code Online (Sandbox Code Playgroud)
你可能会试试
#include <Python.h>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
11615 次 |
| 最近记录: |