用pip安裝第三方包的時候,有時候會遇到fatal error: Python.h: No such file or directory compilation terminated
這樣的報錯婉称。因為這些庫使用了c擴展块仆,需要編譯,然后又找不到頭文件和靜態(tài)庫導致的王暗。編譯這些c庫需要的依賴庫由python dev
提供悔据,安裝即可:
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, RHEL...):
sudo yum install python-devel # for python2.x installs
sudo yum install python34-devel # for python3.4 installs
For dnf (Fedora...):
sudo dnf install python2-devel # for python2.x installs
sudo dnf install python3-devel # for python3.x installs
For zypper (openSUSE...):
sudo zypper in python-devel # for python2.x installs
sudo zypper in python3-devel # for python3.x installs