Python headers not found錯誤解決辦法


安裝Python擴展時,Configure error: Python headers not found錯誤解決辦法

在安裝spot時,遇到#include "Python.h"找不到錯誤:

checking Python.h usability... no
checking Python.h presence... no
checking for Python.h... no
configure: error: Python's development headers are not installed.

原因
無法找到 python 庫,#include "Python.h" 出錯 ,缺少python-devpython3-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 python34-devel   # for python3.4 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

[1] python-dev 庫缺失導致安裝 matplotlib 出錯


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM