安装 matplotlib 时出错

安装 matplotlib 时出错

我在 Ubuntu 15.04(Python 2.7.9)下尝试matplotlib安装时出现以下错误。pip

Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/pip/basecommand.py", line 122, in main
    status = self.run(options, args)
  File "/usr/lib/python2.7/dist-packages/pip/commands/install.py", line 304, in run
    requirement_set.prepare_files(finder, force_root_egg_info=self.bundle, bundle=self.bundle)
  File "/usr/lib/python2.7/dist-packages/pip/req.py", line 1230, in prepare_files
    req_to_install.run_egg_info()
  File "/usr/lib/python2.7/dist-packages/pip/req.py", line 326, in run_egg_info
    command_desc='python setup.py egg_info')
  File "/usr/lib/python2.7/dist-packages/pip/util.py", line 716, in call_subprocess
    % (command_desc, proc.returncode, cwd))
InstallationError: Command python setup.py egg_info failed with error code 1 in /tmp/pip-build-hP0laO/matplotlib

说实话,我不知道为什么呼叫setup.py 失败。

答案1

我正在使用 matplotlib 和其他scipy类似的包伊帕特里克numpy在 Ubuntu 15.04 中。我已经从 Ubuntu 存储库安装了它们。也许你应该安装python-matplotlibapt-get

您是否尝试过运行: sudo apt-get update; sudo apt-get install python-matplotlib

答案2

setuptools如果尚未安装,您需要安装。要执行此操作,请下载ez_设置.py文件,导航到下载的文件夹并执行:

python ez_setup.py

或者如 pypi 中所述文档,您也可以使用以下命令,它将下载适当的版本并为您安装

wget https://bootstrap.pypa.io/ez_setup.py -O - | sudo python

相关内容