我正在尝试通过全新安装 Raspbian Jessie(撰写本文时为 4.4)在树莓派上安装 matplotlib。我正在尝试为 Python 2.7 安装 matplotlib。
我不断收到以下错误:
command /usr/bin/python -c "import setuptools, tokenize;__file__='/tmp/pip-build-HPuMoo/matplotlib/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-l3s1dW-record/install-record.txt --single-version-externally-managed --compile failed with error code 1 in /tmp/pip-build-HPuMoo/matplotlib
Storing debug log for failure in /home/pi/.pip/pip.log
使事情复杂化......当我安装其他软件包时不会发生这种情况(只是安装 virtualenv 没有问题)但是当我尝试升级 numpy 时它确实发生了。
此外,在 Python 的主要发行版 (/usr/bin/python) 或虚拟环境 (/home/pi/Envs/test/bin/python) 上工作时会发生此错误。然后,我在主要发行版上使用 pip 1.5.6,在 virtualenv 上使用 9.0.1。都失败了。 :(
不确定为什么我会遇到这个问题...考虑到 matplotlib 的广泛使用(以及 Jessie 加载的 python 包的数量),你会认为不会有问题。嗯。
请您参考如下方法:
根据 this answer by Peter Brittain and Anshuman Chhabra ,安装 libpulse-dev 和 python-dev 库应该可以解决您的问题。如图所示Debian Packages references ,这些库的文件列表包括所需的文件。
