当前位置: 首页 > 知识库问答 >
问题:

在Windows 10上,Python 3.6 pip安装matplotlib和其他库失败

鲁钱明
2023-03-14

我最近买了一台新的笔记本电脑,我想安装我所有的python库。但是,其中一些不会安装,比如matplotlib。

关于我的电脑:Windows10和Python3.6,根据pip,这些库。

colorama (0.3.7)
Django (1.8.17)
Mathics (1.0)
mpmath (0.19)
pip (9.0.1)
python-dateutil (2.6.0)
setuptools (32.3.0)
six (1.10.0)
sympy (1.0)
wheel (0.29.0)

“pip安装matplotlib”的结果:

Error processing line 1 of c:\users\marvi\appdata\local\programs\python\python36\lib\site-packages\matplotlib-2.0.0rc2-py3.6-nspkg.pth:

  Traceback (most recent call last):
    File "c:\users\marvi\appdata\local\programs\python\python36\lib\site.py", line 169, in addpackage
      exec(line)
    File "", line 1, in 
    File "", line 557, in module_from_spec
  AttributeError: 'NoneType' object has no attribute 'loader'

Remainder of file ignored
Collecting matplotlib
  Using cached matplotlib-1.5.3.tar.gz
    Complete output from command python setup.py egg_info:
    Error processing line 1 of c:\users\marvi\appdata\local\programs\python\python36\lib\site-packages\matplotlib-2.0.0rc2-py3.6-nspkg.pth:

      Traceback (most recent call last):
        File "c:\users\marvi\appdata\local\programs\python\python36\lib\site.py", line 169, in addpackage
          exec(line)
        File "", line 1, in 
        File "", line 557, in module_from_spec
      AttributeError: 'NoneType' object has no attribute 'loader'

    Remainder of file ignored
    Error processing line 1 of c:\users\marvi\appdata\local\programs\python\python36\lib\site-packages\matplotlib-2.0.0rc2-py3.6-nspkg.pth:

      Traceback (most recent call last):
        File "c:\users\marvi\appdata\local\programs\python\python36\lib\site.py", line 169, in addpackage
          exec(line)
        File "", line 1, in 
        File "", line 557, in module_from_spec
      AttributeError: 'NoneType' object has no attribute 'loader'

    Remainder of file ignored
    Error processing line 1 of c:\users\marvi\appdata\local\programs\python\python36\lib\site-packages\matplotlib-2.0.0rc2-py3.6-nspkg.pth:

      Traceback (most recent call last):
        File "c:\users\marvi\appdata\local\programs\python\python36\lib\site.py", line 169, in addpackage
          exec(line)
        File "", line 1, in 
        File "", line 557, in module_from_spec
      AttributeError: 'NoneType' object has no attribute 'loader'

    Remainder of file ignored
    Error processing line 1 of c:\users\marvi\appdata\local\programs\python\python36\lib\site-packages\matplotlib-2.0.0rc2-py3.6-nspkg.pth:

      Traceback (most recent call last):
        File "c:\users\marvi\appdata\local\programs\python\python36\lib\site.py", line 169, in addpackage
          exec(line)
        File "", line 1, in 
        File "", line 557, in module_from_spec
      AttributeError: 'NoneType' object has no attribute 'loader'

    Remainder of file ignored
    Error processing line 1 of c:\users\marvi\appdata\local\programs\python\python36\lib\site-packages\matplotlib-2.0.0rc2-py3.6-nspkg.pth:

      Traceback (most recent call last):
        File "c:\users\marvi\appdata\local\programs\python\python36\lib\site.py", line 169, in addpackage
          exec(line)
        File "", line 1, in 
        File "", line 557, in module_from_spec
      AttributeError: 'NoneType' object has no attribute 'loader'

    Remainder of file ignored
    Error processing line 1 of c:\users\marvi\appdata\local\programs\python\python36\lib\site-packages\matplotlib-2.0.0rc2-py3.6-nspkg.pth:

      Traceback (most recent call last):
        File "c:\users\marvi\appdata\local\programs\python\python36\lib\site.py", line 169, in addpackage
          exec(line)
        File "", line 1, in 
        File "", line 557, in module_from_spec
      AttributeError: 'NoneType' object has no attribute 'loader'

    Remainder of file ignored
    Error processing line 1 of c:\users\marvi\appdata\local\programs\python\python36\lib\site-packages\matplotlib-2.0.0rc2-py3.6-nspkg.pth:

      Traceback (most recent call last):
        File "c:\users\marvi\appdata\local\programs\python\python36\lib\site.py", line 169, in addpackage
          exec(line)
        File "", line 1, in 
        File "", line 557, in module_from_spec
      AttributeError: 'NoneType' object has no attribute 'loader'

    Remainder of file ignored
    Error processing line 1 of c:\users\marvi\appdata\local\programs\python\python36\lib\site-packages\matplotlib-2.0.0rc2-py3.6-nspkg.pth:

      Traceback (most recent call last):
        File "c:\users\marvi\appdata\local\programs\python\python36\lib\site.py", line 169, in addpackage
          exec(line)
        File "", line 1, in 
        File "", line 557, in module_from_spec
      AttributeError: 'NoneType' object has no attribute 'loader'

    Remainder of file ignored
    Error processing line 1 of c:\users\marvi\appdata\local\programs\python\python36\lib\site-packages\matplotlib-2.0.0rc2-py3.6-nspkg.pth:

      Traceback (most recent call last):
        File "c:\users\marvi\appdata\local\programs\python\python36\lib\site.py", line 169, in addpackage
          exec(line)
        File "", line 1, in 
        File "", line 557, in module_from_spec
      AttributeError: 'NoneType' object has no attribute 'loader'

    Remainder of file ignored
 Error processing line 1 of c:\users\marvi\appdata\local\programs\python\python36\lib\site-packages\matplotlib-2.0.0rc2-py3.6-nspkg.pth:

      Traceback (most recent call last):
        File "c:\users\marvi\appdata\local\programs\python\python36\lib\site.py", line 169, in addpackage
          exec(line)
        File "", line 1, in 
        File "", line 557, in module_from_spec
      AttributeError: 'NoneType' object has no attribute 'loader'

    Remainder of file ignored
    Error processing line 1 of c:\users\marvi\appdata\local\programs\python\python36\lib\site-packages\matplotlib-2.0.0rc2-py3.6-nspkg.pth:

      Traceback (most recent call last):
        File "c:\users\marvi\appdata\local\programs\python\python36\lib\site.py", line 169, in addpackage
          exec(line)
        File "", line 1, in 
        File "", line 557, in module_from_spec
      AttributeError: 'NoneType' object has no attribute 'loader'

    Remainder of file ignored
    Error processing line 1 of c:\users\marvi\appdata\local\programs\python\python36\lib\site-packages\matplotlib-2.0.0rc2-py3.6-nspkg.pth:

      Traceback (most recent call last):
        File "c:\users\marvi\appdata\local\programs\python\python36\lib\site.py", line 169, in addpackage
          exec(line)
        File "", line 1, in 
        File "", line 557, in module_from_spec
      AttributeError: 'NoneType' object has no attribute 'loader'

    Remainder of file ignored
    Error processing line 1 of c:\users\marvi\appdata\local\programs\python\python36\lib\site-packages\matplotlib-2.0.0rc2-py3.6-nspkg.pth:

      Traceback (most recent call last):
        File "c:\users\marvi\appdata\local\programs\python\python36\lib\site.py", line 169, in addpackage
          exec(line)
        File "", line 1, in 
        File "", line 557, in module_from_spec
      AttributeError: 'NoneType' object has no attribute 'loader'

    Remainder of file ignored
    Error processing line 1 of c:\users\marvi\appdata\local\programs\python\python36\lib\site-packages\matplotlib-2.0.0rc2-py3.6-nspkg.pth:

      Traceback (most recent call last):
        File "c:\users\marvi\appdata\local\programs\python\python36\lib\site.py", line 169, in addpackage
          exec(line)
        File "", line 1, in 
        File "", line 557, in module_from_spec
      AttributeError: 'NoneType' object has no attribute 'loader'

    Remainder of file ignored
    Error processing line 1 of c:\users\marvi\appdata\local\programs\python\python36\lib\site-packages\matplotlib-2.0.0rc2-py3.6-nspkg.pth:

      Traceback (most recent call last):
        File "c:\users\marvi\appdata\local\programs\python\python36\lib\site.py", line 169, in addpackage
          exec(line)
        File "", line 1, in 
        File "", line 557, in module_from_spec
      AttributeError: 'NoneType' object has no attribute 'loader'

    Remainder of file ignored
    Error processing line 1 of c:\users\marvi\appdata\local\programs\python\python36\lib\site-packages\matplotlib-2.0.0rc2-py3.6-nspkg.pth:

      Traceback (most recent call last):
        File "c:\users\marvi\appdata\local\programs\python\python36\lib\site.py", line 169, in addpackage
          exec(line)
        File "", line 1, in 
        File "", line 557, in module_from_spec
      AttributeError: 'NoneType' object has no attribute 'loader'

    Remainder of file ignored
    Error processing line 1 of c:\users\marvi\appdata\local\programs\python\python36\lib\site-packages\matplotlib-2.0.0rc2-py3.6-nspkg.pth:

      Traceback (most recent call last):
        File "c:\users\marvi\appdata\local\programs\python\python36\lib\site.py", line 169, in addpackage
          exec(line)
        File "", line 1, in 
        File "", line 557, in module_from_spec
      AttributeError: 'NoneType' object has no attribute 'loader'

    Remainder of file ignored
    ============================================================================
    Edit setup.cfg to change the build options

    BUILDING MATPLOTLIB
                matplotlib: yes [1.5.3]
                    python: yes [3.6.0 (v3.6.0:41df79263a11, Dec 23 2016,
                            08:06:12) [MSC v.1900 64 bit (AMD64)]]
                  platform: yes [win32]

    REQUIRED DEPENDENCIES AND EXTENSIONS
                     numpy: yes [not found. pip may install it below.]
                  dateutil: yes [using dateutil version 2.6.0]
                      pytz: yes [pytz was not found. pip will attempt to install
                            it after matplotlib.]
                    cycler: yes [cycler was not found. pip will attempt to
                            install it after matplotlib.]
                   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 [pyparsing was not found. It is required for
                            mathtext support. pip/easy_install may attempt to
                            install it after matplotlib.]
                    libagg: yes [pkg-config information for 'libagg' could not
                            be found. Using local copy.]
                  freetype: no  [The C/C++ header for freetype (ft2build.h)
                            could not be found.  You may need to install the
                            development package.]
                       png: no  [The C/C++ header for png (png.h) could not be
                            found.  You may need to install the development
                            package.]
                     qhull: yes [pkg-config information for 'qhull' could not be
                            found. Using local copy.]

    OPTIONAL SUBPACKAGES
               sample_data: yes [installing]
                  toolkits: yes [installing]
                     tests: yes [nose 0.11.1 or later is required to run the
                            matplotlib test suite. Please install it with pip or
                            your preferred tool to run the test suite / using
                            unittest.mock]
            toolkits_tests: yes [nose 0.11.1 or later is required to run the
                            matplotlib test suite. Please install it with pip or
                            your preferred tool to run the test suite / using
                            unittest.mock]

    OPTIONAL BACKEND EXTENSIONS
                    macosx: no  [Mac OS-X only]
                    qt5agg: no  [PyQt5 not found]
                    qt4agg: no  [PySide not found; PyQt4 not found]
                   gtk3agg: no  [Requires pygobject to be installed.]
                 gtk3cairo: no  [Requires cairocffi or pycairo to be installed.]
                    gtkagg: no  [Requires pygtk]
                     tkagg: yes [installing; run-time loading from Python Tcl /
                            Tk]
                     wxagg: no  [requires wxPython]
                       gtk: no  [Requires pygtk]
                       agg: yes [installing]
                     cairo: no  [cairocffi or pycairo not found]
                 windowing: yes [installing]

    OPTIONAL LATEX DEPENDENCIES
                    dvipng: no
               ghostscript: no
                     latex: no
                   pdftops: no

    OPTIONAL PACKAGE DATA
                      dlls: no  [skipping due to configuration]

    ============================================================================
                            * The following required packages can not be built:
                            * freetype, png

    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in C:\Users\marvi\AppData\Local\Temp\pip-build-a0hjoody\matplotlib\

基本上,一些关于缓存文件的东西,一些来自站点的属性错误。py和一些关于没有freetype或png的东西。我试图修复这个网站。是的,但还是不起作用。我试过了。来自PyPi的whl文件,但这不起作用。我试过“pip安装matplotlib——没有缓存目录”,同样的道理。我尝试手动下载png和freetype,但找不到它们。我想下载的所有其他库的情况大致相同:NumPy、SciPy、pandas。

共有3个答案

葛修筠
2023-03-14

和你一样,我在这件事上绕了一圈!

如果您是从PyPI安装的,应该可以。我使用了matplotlib-2.0。0rc2-cp36-cp36m-win32。whl,但也有64位版本。

我是用cmd安装的。exe“以管理员身份运行”,python目录位于我的路径中:

pip3 install matplotlib-2.0.0rc2-cp36-cp36m-win32.whl
曹伟泽
2023-03-14

1.5.1版本没有这个问题,能不能检查一下这个:

pip install matplotlib==1.5.1 
戚明朗
2023-03-14

如果你在Python 3.6中使用anaconda,你可以使用:

conda install -c conda-forge python=3.6.0
conda install matplotlib --channel conda-forge

要下载anaconda,请访问https://www.continuum.io/downloads

 类似资料:
  • 运行mysqlclient的setup.py clean无法生成安装收集的包的mysqlclient:mysqlclient运行mysqlclient的setup.py install...错误错误:命令出错,退出状态1:命令:'c:\users\uaahacker\appdata\local\programs\python\python38-32\python.exe'-u-c'import s

  • 主要内容:使用pip理器安装,使用Anaconda安装,验证安装Matplotlib 是 Python 的第三方绘图库,它非常类似于 MATLAB。在使用 Matplotlib 软件包之前,需要对其进行安装。本节以 Windows10 系统为例,介绍 Matplotlib 的几种安装方式。 MATLAB 是一款商业软件,主要用于数据分析、图像处理、计算机视觉等领域。 使用pip理器安装 使用 Python 包管理器 pip 来安装 Matplotlib 是一种

  • 本文向大家介绍windows10安装mysql5.7.17教程,包括了windows10安装mysql5.7.17教程的使用技巧和注意事项,需要的朋友参考一下 本教程为大家分享了mysql5.7.17安装配置方法,供大家参考,具体内容如下 操作 全允许 精彩专题分享:mysql不同版本安装教程 mysql5.7各版本安装教程 以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持呐喊

  • 本文向大家介绍windows10安装mysql5.7.18教程,包括了windows10安装mysql5.7.18教程的使用技巧和注意事项,需要的朋友参考一下 本教程为大家分享了mysql5.7.18安装配置方法,供大家参考,具体内容如下 一、mysql5.7.18安装配置 1、MySQL下载:https://www.mysql.com/downloads/ Download MySQL Comm

  • 本文向大家介绍Mysql5.7.11在windows10上的安装与配置(解压版),包括了Mysql5.7.11在windows10上的安装与配置(解压版)的使用技巧和注意事项,需要的朋友参考一下 第一步 第二步 右击我的电脑–>属性–>高级–>环境变量,在path里面添加mysql bin目录的路径。 选择环境变量,在环境变量中的Path路径下输入MySQL路径到bin下就ok了。 如D:\mys

  • 本文向大家介绍python绘图库Matplotlib的安装,包括了python绘图库Matplotlib的安装的使用技巧和注意事项,需要的朋友参考一下 本文简单介绍了Python绘图库Matplotlib的安装,简介如下: matplotlib是python最著名的绘图库,它提供了一整套和matlab相似的命令API,十分适合交互式地 进行制图。Matplotlib的安装可以参见:官网链接 htt