2 8*_*2 8 5 arch-linux pacman python
我使用 Arch Linux。我想编译一个包含<Python.h>
. 但我做不到。
在基于 Debian 的系统中,这个问题通过sudo apt-get install python-dev
. 我如何用 pacman 安装这个包?
* 编辑 *
我不想编译这个文件
抄送
#include "Python.h"
int main(int argc, char *argv[])
{
Py_SetProgramName(argv[0]); /* optional but recommended */
Py_Initialize();
PyRun_SimpleString("from time import time,ctime\n"
"print 'Today is',ctime(time())\n");
Py_Finalize();
return 0;
}
Run Code Online (Sandbox Code Playgroud)
运行这个命令:
g++ C.c
Run Code Online (Sandbox Code Playgroud)
我有这个错误:
call_function.c:1:20: fatal error: Python.h: No such file or directory
#include "Python.h"
^
compilation terminated.
Run Code Online (Sandbox Code Playgroud)
你应该使用 python 包提供的 libs 和 cflags 编译你的文件:
gcc py.c $(pkg-config --cflags --libs python2) -o py
此外,它应该是#include <Python.h>
相反的。
归档时间: |
|
查看次数: |
5715 次 |
最近记录: |