博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
fatal error: Python.h: No such file or directory | Linux系统 搜索 Python.h 位置
阅读量:2019 次
发布时间:2019-04-28

本文共 1144 字,大约阅读时间需要 3 分钟。

原因:swig C++ 代码转 python

运行命令:

gcc -c -fpic example.c example_wrap.c -I/usr/local/include/python2.0

报错如下:

example_wrap.c:154:21: fatal error: Python.h: No such file or directorycompilation terminated.

因此,我需要找到自己 Linux 服务器的 可用 Python.h


(方法一)找到 系统 python 下的 Python.h

# 去系统下发现可用 Pythoncd /usr/include/find | grep python# 可以发现这里有  python2.7 和  python3.5drwxr-xr-x   2 root root  12288 Aug 10  2018 python2.7/lrwxrwxrwx   1 root root     10 Nov 29  2017 python3.5 -> python3.5m/drwxr-xr-x   2 root root   4096 Feb  2  2018 python3.5m/cd /usr/include/python3.5# 就可以发现 Python.h 文件find | grep Python.h# 输出如下./Python.h
  • 然后正确执行代码(安排Python):
gcc -c -fpic example.c example_wrap.c -I/usr/include/python3.5

便可以顺利完成转化了(该任务可能和您的不一样呢);

(方法二)到 Anaconda3 目录下 寻找含有 Python.h 的 环境

cd /home/moli/anaconda3~/anaconda3$ find | grep Python.h./envs/torch11/include/python3.7m/Python.h./envs/nice/include/python3.6m/Python.h./envs/n2n366/include/python3.6m/Python.h./envs/pix2pix/include/python3.6m/Python.h./envs/tf20/include/python3.6m/Python.h./include/python3.6m/Python.h
  • 使用 conda 下的 Python
gcc -c -fpic example.c example_wrap.c -I/home/moli/anaconda3/include/python3.6m

转载地址:http://fcmxf.baihongyu.com/

你可能感兴趣的文章
什么是RFC?
查看>>
php_network_getaddresses: getaddrinfo failed
查看>>
设计模式-PHP实现单件模式的几种方式
查看>>
使用Jsonp解决跨域数据访问问题
查看>>
Fedora下Zend Studio 6.1.2 的配置
查看>>
Fedora 11 的安装以及 LAMP环境的搭建(一)
查看>>
MYSQL在众多表中查询表名和字段名
查看>>
为什么选择Mapabc
查看>>
IE支持而Firefox不支持的CSS属性
查看>>
Eclipse Galileo SR2 参数配置
查看>>
彻底理解Doctype
查看>>
Solaris已经死了,Linux万岁
查看>>
警惕Div和Class的滥用
查看>>
Google首页的一个细微变化
查看>>
通过设置双网卡实现VirtualBox虚机上网及主宿互访
查看>>
基于Mapabc API的周边查询应用
查看>>
PHP性能监测的工具介绍 - XHProf
查看>>
利用PUT方式上传文件的方法研究
查看>>
使用YUI3创建Popup弹出层
查看>>
VIM在多窗口编辑时的几个快捷键
查看>>