2017年4月11日 星期二

[ Python 常見問題 ] fatal error: Python.h: No such file or directory

Source From Here
Question
I am trying to build a shared library using a C extension file but first I have to generate the output file using the command below:
# gcc -Wall utilsmodule.c -o Utilc

After executing the command, I get this error message:
utilsmodule.c:1:20: fatal error: Python.h: No such file or directory compilation terminated.

in fact I have tried all the suggested solutions over the internet but the problem still exists ... also I have no problem with Python.h. I managed to locate the file on my machine ... anybody has faced the same problem before??

How-To
Looks like you haven't properly installed the header files and static libraries for python dev. Use your package manager to install them system-wide.
For apt (ubuntu, debian...):
# sudo apt-get install python-dev // for python2.x installs
# sudo apt-get install python3-dev // for python3.x installs

For yum (centos, redhat, fedora...):
# sudo yum install python-devel


沒有留言:

張貼留言

[Git 常見問題] error: The following untracked working tree files would be overwritten by merge

  Source From  Here 方案1: // x -----删除忽略文件已经对 git 来说不识别的文件 // d -----删除未被添加到 git 的路径中的文件 // f -----强制运行 #   git clean -d -fx 方案2: 今天在服务器上  gi...