简体   繁体   English

我应该将C源文件放在Python程序中的什么位置?

[英]Where should I put the C source files in a Python program?

I am trying to compile a Python program which includes some C files. 我正在尝试编译包含一些C文件的Python程序。

In one file emodule.c it reads: 在一个文件emodule.c其内容为:

#include "Python.h"
#include "ul/ul.h"

I already have the ul folder and put it in the same folder with emodule.c , however, when I run python setup.py build , it stills says: 我已经有了ul文件夹,并将其与emodule.c放在同一文件夹中,但是,当我运行python setup.py build ,它仍然显示:

fatal error: ul/ul.h: No such file or directory
compilation terminated.
error: command 'gcc' failed with exit status 1

Where should I put the ul folder? ul文件夹应该放在哪里?

Try adding include_dirs = ['ul'] to the call to setup() in setup.py . 尝试在setup.py中将include_dirs = ['ul']到对setup()的调用中。

See the Preprocessor Options section of the setupscripts documentation for more information. 有关更多信息,请参见setupscripts文档的Preprocessor Options部分。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM