【问题标题】:AttributeError with pip install matplotlibAttributeError 与 pip install matplotlib
【发布时间】:2015-08-12 13:44:22
【问题描述】:

我正在尝试在 Ubuntu Linux 上的 virtualenv 中安装带有 pip 的 matplotlib。我已经成功安装了一堆包——这是失败的包。如输出所示,这是 python 2.7.3,所有依赖项都已存在。

这是特定于 v1.4.3 的 matplotlib 吗?我应该安装早期版本吗?我什至手动安装了 mock (v1.3.0),因为尝试导入它时安装似乎失败了,但这也无济于事。

这是输出: 收集 matplotlib 使用缓存的 matplotlib-1.4.3.tar.gz 命令 python setup.py egg_info 的完整输出: ==================================================== =========================== 编辑 setup.cfg 以更改构建选项

BUILDING MATPLOTLIB
            matplotlib: yes [1.4.3]
                python: yes [2.7.3 (default, Jun 22 2015, 19:33:41)  [GCC
                        4.6.3]]
              platform: yes [linux2]

REQUIRED DEPENDENCIES AND EXTENSIONS
                 numpy: yes [version 1.9.2]
                   six: yes [using six version 1.9.0]
              dateutil: yes [using dateutil version 2.4.2]
                  pytz: yes [using pytz version 2015.4]
               tornado: yes [tornado was not found. It is required for the
                        WebAgg backend. pip/easy_install may attempt to
                        install it after matplotlib.]
             pyparsing: yes [using pyparsing version 2.0.3]
                 pycxx: yes [Couldn't import.  Using local copy.]
                libagg: yes [pkg-config information for 'libagg' could not
                        be found. Using local copy.]
              freetype: yes [version 2.4.8]
                   png: yes [version 1.2.46]
                 qhull: yes [pkg-config information for 'qhull' could not be
                        found. Using local copy.]

OPTIONAL SUBPACKAGES
           sample_data: yes [installing]
              toolkits: yes [installing]
Traceback (most recent call last):
  File "<string>", line 20, in <module>
  File "/tmp/pip-build-mHyI6G/matplotlib/setup.py", line 155, in <module>
    result = package.check()
  File "setupext.py", line 666, in check
    import mock
  File "/home/awarnock/PyProjects/OMTO3dIMG/local/lib/python2.7/site-packages/mock/__init__.py", line 2, in <module>
    import mock.mock as _mock
  File "/home/awarnock/PyProjects/OMTO3dIMG/local/lib/python2.7/site-packages/mock/mock.py", line 71, in <module>
    _v = VersionInfo('mock').semantic_version()
AttributeError: 'VersionInfo' object has no attribute 'semantic_version'

----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip- build-mHyI6G/matplotlib

提前感谢您的任何建议。

【问题讨论】:

  • 请不要再打电话了。我想我有答案。看来 uninstalling 模拟首先会起作用。以下成功: pip uninstall mock pip install --no-deps --ignore-installed matplotlib

标签: python-2.7 matplotlib


【解决方案1】:

你可以试试:

pip install oslo.utils

或者:

pip install testrepository
pip install oslo.utils

你也可以用包安装它:

Debian / Ubuntu:

apt-get install python-matplotlib

红帽/CentOS:

yum install python-matplotlib

【讨论】:

    猜你喜欢
    • 2015-11-01
    • 1970-01-01
    • 2022-01-16
    • 1970-01-01
    • 2017-03-20
    • 2021-05-13
    • 2017-09-22
    • 2022-01-17
    • 1970-01-01
    相关资源
    最近更新 更多