网站首页 文章专栏 centos, ubuntu , Debian, Fedora,openSUSE.... 安装install python 头文件及静态库
fatal error: Python.h: No such file or directory
出现上述报错时,肯定是你在编译加安装python 相关模块或软件的时候,缺少 python-dev 头文件及静态库。
下面来把各 linux 发行版本的install python-dev 方法列出来:
使用 apt (ubuntu, Debian...)
sudo apt-get install python-dev # for python2.x installs sudo apt-get install python3-dev # for python3.x installs使用 yum (centos, RHEL...)
sudo yum install python-devel # for python2.x installs sudo yum install python3-devel # for python3.x installs使用 dnf (fedora...)
sudo dnf install python2-devel # for python2.x installs sudo dnf install python3-devel # for python3.x installs
使用 zypper (opensuse...)
sudo zypper in python-devel # for python2.x installs sudo zypper in python3-devel # for python3.x installs
使用 apk (alpine...)
sudo apk add python2-dev # for python2.x installs sudo apk add python3-dev # for python3.x installs
使用 apt-cyg (Cygwin...)
apt-cyg install python-devel # for python2.x installs apt-cyg install python3-devel # for python3.x installs