解决Python.h: No such file or directory
程序员文章站
2024-02-21 23:25:10
...
具体报错信息如下:
In file included from src/hiredis.c:1:0:
src/hiredis.h:4:10: fatal error: Python.h: No such file or directory
#include <Python.h>
^~~~~~~~~~
compilation terminated.
error: command 'gcc' failed with exit status 1
报错是找不到Python.h 文件,主要是 python-dev 或 python-devel 包没有安装导致了,而我的系统是麒麟 ARM架构:
uname -a
Linux root 4.19.90-23.6.v2101.ky10.aarch64 #1 SMP Wed Mar 17 14:45:17 CST 2021 aarch64 aarch64 aarch64 GNU/Linux
安装的包名和安装命令有所不同,正确命令如下:
dnf install python3-devel # 我这里用的是python3
下面是其他系统使用到安装命令:
For apt (Ubuntu, Debian...):
sudo apt-get install python-dev # for python2.x
sudo apt-get install python3-dev # for python3.x
-------------------------------------------------
For yum (CentOS, RHEL...):
sudo yum install python-devel # for python2.x
sudo yum install python3-devel # for python3.x
-------------------------------------------------
For dnf (Fedora, Kylin V10...):
sudo dnf install python2-devel # for python2.x
sudo dnf install python3-devel # for python3.x
-------------------------------------------------
For zypper (openSUSE...):
sudo zypper in python-devel # for python2.x
sudo zypper in python3-devel # for python3.x
-------------------------------------------------
For apk (Alpine...):
sudo apk add python2-dev # for python2.x
sudo apk add python3-dev # for python3.x
-------------------------------------------------
For apt-cyg (Cygwin...):
apt-cyg install python-devel # for python2.x
apt-cyg install python3-devel # for python3.x
-------------------------------------------------
For yum AWS API (centOS)
yum install python27-devel # for python2.x
yum install python37-devel # for python3.x
-------------------------------------------------
For other
apt install libpython3.7-dev
apt install libpython3-all-dev
-------------------------------------------------
由于面对的操作系统不同,python版本的不同,使用的安装命令也不同,总体总结为
安装命令:apt-get、apt、yum、apt-cyg、apk、zypper、dnf
包名:python-devel、python-dev、libpython-dev、libpython-all-dev
版本:2、3、2.7、3.7、27、37等等
上面的三项,就可以组成很多种命令,实在不知道是哪个,就试吧。祝你成功!
上一篇: 初识Java8中的Stream
下一篇: 计算机网络:自顶向下方法读书笔记(五)
推荐阅读
-
解决Python.h: No such file or directory
-
fatal error: Python.h: No such file or directory/ fatal error: numpy/ndarrayobject.h: No such file o
-
fatal error: Python.h: No such file or directory #include “Python.h“
-
PHP中使用file_get_contents抓取网页中文乱码问题解决方法
-
sqoop --direct报错 Cannot run program "mysqldump": error=2, No such file or directory
-
Mac IntelliJ - Cannot run program “docker”: error=2, No such file or directory
-
failed to open stream: No such file or directory 问题大全
-
failed to open stream: No such file or directory 问题大全
-
运行PHP出现No input file specified错误的解决办法
-
file_exists一直不存在,该怎么解决