Python ubuntu 14.04,pip 无法升级 matplotllib

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/25674612/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-18 23:28:36  来源:igfitidea点击:

ubuntu 14.04, pip cannot upgrade matplotllib

pythonmatplotlibpip

提问by astroboylrx

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!

为什么失败了?非常感谢!

采纳答案by tacaswell

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 freetypeinstallation. 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

回答by Zeinab Mahdavifar

On Ubuntu 14 server, you also need to install libxft-dev

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

sudo apt-get install libfreetype6-dev libxft-dev

回答by tchakravarty

I had the same issues trying to install matplotlibon Python 3 using pip3, and it seems that this problem is related to a bare-bones installation of Python 3, and doing a:

我在尝试使用 安装matplotlib在 Python 3 上时遇到了同样的问题pip3,似乎这个问题与 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.

回答by Chase Roberts

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

回答by Artem Gromov

Found this page while looking answer for fedora 24.

在寻找 Fedora 24 的答案时找到了这个页面。

RPM solution is:

RPM 解决方案是:

dnf install freetype-devel

dnf install freetype-devel

回答by Rochan

I was trying too update directly using sudo pip but changes are not saved in last. So i first use update cmd in terminal:

我也尝试使用 sudo pip 直接更新,但最后没有保存更改。所以我首先在终端中使用更新 cmd:

sudo apt-get update

then i used sudo install:

然后我使用 sudo 安装:

sudo apt-get install libffi-dev

Finally its installed by doing this method.

最后通过这种方法安装它。

回答by Ahmed Hamed

If you re running Ubuntu server 14.04 u should add this font dependency

如果您正在运行 Ubuntu 服务器 14.04,您应该添加此字体依赖项

sudo apt-get install libxft-dev

Source

来源

回答by Jean Spector

For those on Fedora 25 hitting this thread, I needed these two packages to make it work:

对于那些在 Fedora 25 上遇到这个线程的人,我需要这两个包来使它工作:

sudo dnf install freetype-devel gcc-c++

回答by Saurabh Singh

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