简体   繁体   English

ubuntu 14.04,pip无法升级matplotllib

[英]ubuntu 14.04, pip cannot upgrade matplotllib

When I try to upgrade my matplotlib using pip, it outputs: 当我尝试使用pip升级matplotlib时,输出:

Downloading/unpacking matplotlib from https://pypi.python.org/packages/source/m/matplotlib/matplotlib-1.4.0.tar.gz#md5=1daf7f2123d94745feac1a30b210940c
  Downloading matplotlib-1.4.0.tar.gz (51.2MB): 51.2MB downloaded
  Running setup.py (path:/tmp/pip_build_root/matplotlib/setup.py) egg_info for package matplotlib
    ============================================================================
    Edit setup.cfg to change the build options

    BUILDING MATPLOTLIB
                matplotlib: yes [1.4.0]
                    python: yes [2.7.6 (default, Mar 22 2014, 22:59:38)  [GCC
                            4.8.2]]
                  platform: yes [linux2]

    REQUIRED DEPENDENCIES AND EXTENSIONS
                     numpy: yes [version 1.8.2]
                       six: yes [using six version 1.7.3]
                  dateutil: yes [using dateutil version 2.2]
                   tornado: yes [using tornado version 4.0.1]
                 pyparsing: yes [using pyparsing version 2.0.2]
                     pycxx: yes [Couldn't import.  Using local copy.]
                    libagg: yes [pkg-config information for 'libagg' could not
                            be found. Using local copy.]
    Traceback (most recent call last):
      File "<string>", line 17, in <module>
      File "/tmp/pip_build_root/matplotlib/setup.py", line 154, in <module>
        result = package.check()
      File "setupext.py", line 940, in check
        if 'No such file or directory\ngrep:' in version:
    TypeError: argument of type 'NoneType' is not iterable
    Complete output from command python setup.py egg_info:
    ============================================================================

Edit setup.cfg to change the build options



BUILDING MATPLOTLIB

            matplotlib: yes [1.4.0]

                python: yes [2.7.6 (default, Mar 22 2014, 22:59:38)  [GCC

                        4.8.2]]

              platform: yes [linux2]



REQUIRED DEPENDENCIES AND EXTENSIONS

                 numpy: yes [version 1.8.2]

                   six: yes [using six version 1.7.3]

              dateutil: yes [using dateutil version 2.2]

               tornado: yes [using tornado version 4.0.1]

             pyparsing: yes [using pyparsing version 2.0.2]

                 pycxx: yes [Couldn't import.  Using local copy.]

                libagg: yes [pkg-config information for 'libagg' could not

                        be found. Using local copy.]

Traceback (most recent call last):

  File "<string>", line 17, in <module>

  File "/tmp/pip_build_root/matplotlib/setup.py", line 154, in <module>

    result = package.check()

  File "setupext.py", line 940, in check

    if 'No such file or directory\ngrep:' in version:

TypeError: argument of type 'NoneType' is not iterable

----------------------------------------
Cleaning up...
Command python setup.py egg_info failed with error code 1 in /tmp/pip_build_root/matplotlib
Storing debug log for failure in /home/username/.pip/pip.log

In the tail of the log it says: 在日志的末尾说:

Exception information:
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/pip-1.5.6-py2.7.egg/pip/basecommand.py", line 122, in main
    status = self.run(options, args)
  File "/usr/local/lib/python2.7/dist-packages/pip-1.5.6-py2.7.egg/pip/commands/install.py", line 278, in run
    requirement_set.prepare_files(finder, force_root_egg_info=self.bundle, bundle=self.bundle)
  File "/usr/local/lib/python2.7/dist-packages/pip-1.5.6-py2.7.egg/pip/req.py", line 1229, in prepare_files
    req_to_install.run_egg_info()
  File "/usr/local/lib/python2.7/dist-packages/pip-1.5.6-py2.7.egg/pip/req.py", line 325, in run_egg_info
    command_desc='python setup.py egg_info')
  File "/usr/local/lib/python2.7/dist-packages/pip-1.5.6-py2.7.egg/pip/util.py", line 697, in call_subprocess
    % (command_desc, proc.returncode, cwd))
InstallationError: Command python setup.py egg_info failed with error code 1 in /tmp/pip_build_root/matplotlib

Why did it fail? 为什么失败了? Many thanks! 非常感谢!

This is a known bug that has been fixed ( https://github.com/matplotlib/matplotlib/pull/3414 ) on master. 这是一个已知的错误,已在master上修复( https://github.com/matplotlib/matplotlib/pull/3414 )。

The bug is in the handling of searching for a freetype installation. 该错误在于搜索自由类型安装的处理。 If you install the Linux package freetype-dev, you will avoid this bug and be able to compile matplotlib . 如果安装Linux软件包freetype-dev,则可以避免该错误并能够编译matplotlib

sudo apt-get install libfreetype6-dev

在Ubuntu 14服务器上,您还需要安装libxft-dev

sudo apt-get install libfreetype6-dev libxft-dev

I had the same issues trying to install matplotlib on Python 3 using pip3 , and it seems that this problem is related to a bare-bones installation of Python 3, and doing a: 尝试使用pip3在Python 3上安装matplotlib ,我遇到了同样的问题,看来这个问题与Python 3的准系统安装有关,并且执行以下操作:

sudo apt-get build-dep matplotlib

followed by 其次是

sudo pip3 install matplotlib 

is probably a better solution than selectively installing only the libraries related to matplotlib . 与仅选择性地安装与matplotlib相关的库相比,它是一个更好的解决方案。

Since mac doesn't have apt-get you, on OSX you may need to do: 由于mac没有apt-get,因此在OSX上,您可能需要执行以下操作:

brew install freetype

then you can run: 然后您可以运行:

pip install matplotlib

Found this page while looking answer for fedora 24. 在寻找fedora 24的答案时找到了此页面。

RPM solution is: RPM解决方案是:

dnf install freetype-devel

If you re running Ubuntu server 14.04 u should add this font dependency 如果您正在运行Ubuntu服务器14.04,则应添加此字体依赖项

sudo apt-get install libxft-dev

Source 资源

I was trying too update directly using sudo pip but changes are not saved in last. 我也尝试直接使用sudo pip更新,但更改未保存在最后。 So i first use update cmd in terminal: 所以我首先在终端中使用update cmd:

sudo apt-get update

then i used sudo install: 然后我用sudo install:

sudo apt-get install libffi-dev

Finally its installed by doing this method. 最后通过执行此方法安装它。

对于使用Fedora 25的用户,我需要以下两个软件包才能使其正常工作:

sudo dnf install freetype-devel gcc-c++

This worked for me: 这为我工作:

python -m pip install -U pip setuptools
python -m pip install matplotlib

For more details, follow : https://matplotlib.org/2.0.0/users/installing.html 有关更多详细信息,请访问: https : //matplotlib.org/2.0.0/users/installing.html

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM