表现
1 | sudo pip install matplotlib |
安装 matplotlib 时出现以下错误
1 | Installing collected packages: subprocess32, cycler, backports.functools-lru-cache, pyparsing, kiwisolver, matplotlib |
原因
无法找到 python 库,#include "Python.h"
出错
解决
使用 apt (Ubuntu, Debian…) 安装
1
2sudo apt-get install python-dev # for python2.x installs
sudo apt-get install python3-dev # for python3.x installs使用 yum (CentOS, RHEL…) 安装
1
2sudo yum install python-devel # for python2.x installs
sudo yum install python34-devel # for python3.4 installs使用 dnf (Fedora…) 安装
1
2sudo dnf install python2-devel # for python2.x installs
sudo dnf install python3-devel # for python3.x installs使用 zypper (openSUSE…) 安装
1
2sudo zypper in python-devel # for python2.x installs
sudo zypper in python3-devel # for python3.x installs使用 apk (Alpine…) 安装
1
2sudo apk add python2-dev # for python2.x installs
sudo apk add python3-dev # for python3.x installs