加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > Windows > 正文

为什么在Windows 7(x64)上安装用于Python v3.4的matplotlib失败

发布时间:2020-12-14 01:53:43 所属栏目:Windows 来源:网络整理
导读:我今天下午兴奋地安装了 Python v3.4,因为它现在预装了PIP,但输入pip install matplotlib产生了一个相当令人失望的反应: C:Usersjoncpip install matplotlibDownloading/unpacking matplotlib Running setup.py (path:C:UsersjoncAppDataLocalTempp
我今天下午兴奋地安装了 Python v3.4,因为它现在预装了PIP,但输入pip install matplotlib产生了一个相当令人失望的反应:

C:Usersjonc>pip install matplotlib
Downloading/unpacking matplotlib
  Running setup.py (path:C:UsersjoncAppDataLocalTemppip_build_Joncmatplotlibsetup.py) egg_info for package matpl
otlib
    ============================================================================
    Edit setup.cfg to change the build options

    BUILDING MATPLOTLIB
                matplotlib: yes [1.3.1]
                    python: yes [3.4.0 (v3.4.0:04f714765c13,Mar 16 2014,19:25:23) [MSC v.1600 64 bit (AMD64)]]
                  platform: yes [win32]

    REQUIRED DEPENDENCIES AND EXTENSIONS
                     numpy: yes [not found. pip may install it below.]
                  dateutil: yes [dateutil was not found. It is required for date
                            axis support. pip/easy_install may 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.]
                     pycxx: yes [Official versions of PyCXX are not compatible
                            with Python 3.x.  Using local copy]
                    libagg: yes [pkg-config information for 'libagg' could not
                            be found. Using local copy.]
                  freetype: yes [Unknown version]
                       png: yes [pkg-config information for 'libpng' could not
                            be found. Using unknown version.]

    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]

    OPTIONAL BACKEND EXTENSIONS
                    macosx: no  [Mac OS-X only]
                    qt4agg: no  [PyQt4 not found]
                   gtk3agg: no  [gtk3agg backend does not work on Python 3]
                 gtk3cairo: no  [Requires cairo to be installed.]
                    gtkagg: no  [Requires pygtk]
                     tkagg: no  [The C/C++ header for Tk (tk.h) could not be
                            found.  You may need to install the development
                            package.]
                     wxagg: no  [requires wxPython]
                       gtk: no  [Requires pygtk]
                       agg: yes [installing]
                     cairo: no  [cairo not found]
                 windowing: yes [installing,installing]

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

    non-existing path in 'numpydistutils': 'site.cfg'
    non-existing path in 'numpylib': 'benchmarks'
    Running from numpy source directory.
    C:UsersjoncAppDataLocalTempeasy_install-jzy7ozifnumpy-1.8.1numpydistutilssystem_info.py:1521: UserWarning:

        Atlas (http://math-atlas.sourceforge.net/) libraries not found.
        Directories to search for the libraries can be specified in the
        numpy/distutils/site.cfg file (section [atlas]) or by setting
        the ATLAS environment variable.
      warnings.warn(AtlasNotFoundError.__doc__)
    C:UsersjoncAppDataLocalTempeasy_install-jzy7ozifnumpy-1.8.1numpydistutilssystem_info.py:1530: UserWarning:

        Blas (http://www.netlib.org/blas/) libraries not found.
        Directories to search for the libraries can be specified in the
        numpy/distutils/site.cfg file (section [blas]) or by setting
        the BLAS environment variable.
      warnings.warn(BlasNotFoundError.__doc__)
    C:UsersjoncAppDataLocalTempeasy_install-jzy7ozifnumpy-1.8.1numpydistutilssystem_info.py:1533: UserWarning:

        Blas (http://www.netlib.org/blas/) sources not found.
        Directories to search for the sources can be specified in the
        numpy/distutils/site.cfg file (section [blas_src]) or by setting
        the BLAS_SRC environment variable.
      warnings.warn(BlasSrcNotFoundError.__doc__)
    C:UsersjoncAppDataLocalTempeasy_install-jzy7ozifnumpy-1.8.1numpydistutilssystem_info.py:1427: UserWarning:

        Atlas (http://math-atlas.sourceforge.net/) libraries not found.
        Directories to search for the libraries can be specified in the
        numpy/distutils/site.cfg file (section [atlas]) or by setting
        the ATLAS environment variable.
      warnings.warn(AtlasNotFoundError.__doc__)
    C:UsersjoncAppDataLocalTempeasy_install-jzy7ozifnumpy-1.8.1numpydistutilssystem_info.py:1438: UserWarning:

        Lapack (http://www.netlib.org/lapack/) libraries not found.
        Directories to search for the libraries can be specified in the
        numpy/distutils/site.cfg file (section [lapack]) or by setting
        the LAPACK environment variable.
      warnings.warn(LapackNotFoundError.__doc__)
    C:UsersjoncAppDataLocalTempeasy_install-jzy7ozifnumpy-1.8.1numpydistutilssystem_info.py:1441: UserWarning:

        Lapack (http://www.netlib.org/lapack/) sources not found.
        Directories to search for the sources can be specified in the
        numpy/distutils/site.cfg file (section [lapack_src]) or by setting
        the LAPACK_SRC environment variable.
      warnings.warn(LapackSrcNotFoundError.__doc__)
    C:Python34libdistutilsdist.py:260: UserWarning: Unknown distribution option: 'define_macros'
      warnings.warn(msg)
    Traceback (most recent call last):
      File "<string>",line 17,in <module>
      File "C:UsersjoncAppDataLocalTemppip_build_Joncmatplotlibsetup.py",line 268,in <module>
        **extra_args
      File "C:Python34libdistutilscore.py",line 109,in setup
        _setup_distribution = dist = klass(attrs)
      File "C:Python34libsite-packagessetuptoolsdist.py",line 239,in __init__
        self.fetch_build_eggs(attrs.pop('setup_requires'))
      File "C:Python34libsite-packagessetuptoolsdist.py",line 263,in fetch_build_eggs
        parse_requirements(requires),installer=self.fetch_build_egg
      File "C:Python34libsite-packagespkg_resources.py",line 564,in resolve
        dist = best[req.key] = env.best_match(req,self,installer)
      File "C:Python34libsite-packagespkg_resources.py",line 802,in best_match
        return self.obtain(req,installer) # try and download/install
      File "C:Python34libsite-packagespkg_resources.py",line 814,in obtain
        return installer(requirement)
      File "C:Python34libsite-packagessetuptoolsdist.py",line 313,in fetch_build_egg
        return cmd.easy_install(req)
      File "C:Python34libsite-packagessetuptoolscommandeasy_install.py",line 593,in easy_install
        return self.install_item(spec,dist.location,tmpdir,deps)
      File "C:Python34libsite-packagessetuptoolscommandeasy_install.py",line 623,in install_item
        dists = self.install_eggs(spec,download,tmpdir)
      File "C:Python34libsite-packagessetuptoolscommandeasy_install.py",line 809,in install_eggs
        return self.build_and_install(setup_script,setup_base)
      File "C:Python34libsite-packagessetuptoolscommandeasy_install.py",line 1015,in build_and_install
        self.run_setup(setup_script,setup_base,args)
      File "C:Python34libsite-packagessetuptoolscommandeasy_install.py",line 1000,in run_setup
        run_setup(setup_script,args)
      File "C:Python34libsite-packagessetuptoolssandbox.py",line 50,in run_setup
        lambda: execfile(
      File "C:Python34libsite-packagessetuptoolssandbox.py",line 100,in run
        return func()
      File "C:Python34libsite-packagessetuptoolssandbox.py",line 52,in <lambda>
        {'__file__':setup_script,'__name__':'__main__'}
      File "C:Python34libsite-packagessetuptoolscompat.py",line 78,in execfile
        exec(compile(source,fn,'exec'),globs,locs)
      File "setup.py",in <module>
        author_email="mdroe@stsci.edu",File "setup.py",line 231,in setup_package
        setup_requires = []
      File "C:UsersjoncAppDataLocalTempeasy_install-jzy7ozifnumpy-1.8.1numpydistutilscore.py",line 169,in se
tup
      File "C:Python34libdistutilscore.py",line 149,in setup
        dist.run_commands()
      File "C:Python34libdistutilsdist.py",line 955,in run_commands
        self.run_command(cmd)
      File "C:Python34libdistutilsdist.py",line 974,in run_command
        cmd_obj.run()
      File "C:Python34libsite-packagessetuptoolscommandbdist_egg.py",line 177,in run
        self.run_command("egg_info")
      File "C:Python34libdistutilscmd.py",in run_command
        self.distribution.run_command(command)
      File "C:Python34libdistutilsdist.py",in run_command
        cmd_obj.run()
      File "C:UsersjoncAppDataLocalTempeasy_install-jzy7ozifnumpy-1.8.1numpydistutilscommandegg_info.py",lin
e 10,in run
      File "C:Python34libdistutilscmd.py",in run_command
        cmd_obj.run()
      File "C:UsersjoncAppDataLocalTempeasy_install-jzy7ozifnumpy-1.8.1numpydistutilscommandbuild_src.py",li
ne 153,in run
      File "C:UsersjoncAppDataLocalTempeasy_install-jzy7ozifnumpy-1.8.1numpydistutilscommandbuild_src.py",li
ne 164,in build_sources
      File "C:UsersjoncAppDataLocalTempeasy_install-jzy7ozifnumpy-1.8.1numpydistutilscommandbuild_src.py",li
ne 299,in build_library_sources
      File "C:UsersjoncAppDataLocalTempeasy_install-jzy7ozifnumpy-1.8.1numpydistutilscommandbuild_src.py",li
ne 386,in generate_sources
      File "numpycoresetup.py",line 680,in get_mathlib_info
      File "C:Python34libdistutilscommandconfig.py",line 243,in try_link
        self._check_compiler()
      File "C:UsersjoncAppDataLocalTempeasy_install-jzy7ozifnumpy-1.8.1numpydistutilscommandconfig.py",line
57,in _check_compiler
      File "C:Python34libdistutilsmsvc9compiler.py",line 371,in initialize
        vc_env = query_vcvarsall(VERSION,plat_spec)
      File "C:Python34libdistutilsmsvc9compiler.py",line 287,in query_vcvarsall
        raise ValueError(str(list(result.keys())))
    ValueError: ['path']
    Complete output from command python setup.py egg_info:
    ============================================================================

Edit setup.cfg to change the build options



BUILDING MATPLOTLIB

            matplotlib: yes [1.3.1]

                python: yes [3.4.0 (v3.4.0:04f714765c13,19:25:23) [MSC v.1600 64 bit (AMD64)]]

              platform: yes [win32]



REQUIRED DEPENDENCIES AND EXTENSIONS

                 numpy: yes [not found. pip may install it below.]

              dateutil: yes [dateutil was not found. It is required for date

                        axis support. pip/easy_install may 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.]

                 pycxx: yes [Official versions of PyCXX are not compatible

                        with Python 3.x.  Using local copy]

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

                        be found. Using local copy.]

              freetype: yes [Unknown version]

                   png: yes [pkg-config information for 'libpng' could not

                        be found. Using unknown version.]



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]



OPTIONAL BACKEND EXTENSIONS

                macosx: no  [Mac OS-X only]

                qt4agg: no  [PyQt4 not found]

               gtk3agg: no  [gtk3agg backend does not work on Python 3]

             gtk3cairo: no  [Requires cairo to be installed.]

                gtkagg: no  [Requires pygtk]

                 tkagg: no  [The C/C++ header for Tk (tk.h) could not be

                        found.  You may need to install the development

                        package.]

                 wxagg: no  [requires wxPython]

                   gtk: no  [Requires pygtk]

                   agg: yes [installing]

                 cairo: no  [cairo not found]

             windowing: yes [installing,installing]



OPTIONAL LATEX DEPENDENCIES

                dvipng: no

           ghostscript: no

                 latex: no

               pdftops: no



non-existing path in 'numpydistutils': 'site.cfg'

non-existing path in 'numpylib': 'benchmarks'

Running from numpy source directory.

C:UsersjoncAppDataLocalTempeasy_install-jzy7ozifnumpy-1.8.1numpydistutilssystem_info.py:1521: UserWarning:

    Atlas (http://math-atlas.sourceforge.net/) libraries not found.

    Directories to search for the libraries can be specified in the

    numpy/distutils/site.cfg file (section [atlas]) or by setting

    the ATLAS environment variable.

  warnings.warn(AtlasNotFoundError.__doc__)

C:UsersjoncAppDataLocalTempeasy_install-jzy7ozifnumpy-1.8.1numpydistutilssystem_info.py:1530: UserWarning:

    Blas (http://www.netlib.org/blas/) libraries not found.

    Directories to search for the libraries can be specified in the

    numpy/distutils/site.cfg file (section [blas]) or by setting

    the BLAS environment variable.

  warnings.warn(BlasNotFoundError.__doc__)

C:UsersjoncAppDataLocalTempeasy_install-jzy7ozifnumpy-1.8.1numpydistutilssystem_info.py:1533: UserWarning:

    Blas (http://www.netlib.org/blas/) sources not found.

    Directories to search for the sources can be specified in the

    numpy/distutils/site.cfg file (section [blas_src]) or by setting

    the BLAS_SRC environment variable.

  warnings.warn(BlasSrcNotFoundError.__doc__)

C:UsersjoncAppDataLocalTempeasy_install-jzy7ozifnumpy-1.8.1numpydistutilssystem_info.py:1427: UserWarning:

    Atlas (http://math-atlas.sourceforge.net/) libraries not found.

    Directories to search for the libraries can be specified in the

    numpy/distutils/site.cfg file (section [atlas]) or by setting

    the ATLAS environment variable.

  warnings.warn(AtlasNotFoundError.__doc__)

C:UsersjoncAppDataLocalTempeasy_install-jzy7ozifnumpy-1.8.1numpydistutilssystem_info.py:1438: UserWarning:

    Lapack (http://www.netlib.org/lapack/) libraries not found.

    Directories to search for the libraries can be specified in the

    numpy/distutils/site.cfg file (section [lapack]) or by setting

    the LAPACK environment variable.

  warnings.warn(LapackNotFoundError.__doc__)

C:UsersjoncAppDataLocalTempeasy_install-jzy7ozifnumpy-1.8.1numpydistutilssystem_info.py:1441: UserWarning:

    Lapack (http://www.netlib.org/lapack/) sources not found.

    Directories to search for the sources can be specified in the

    numpy/distutils/site.cfg file (section [lapack_src]) or by setting

    the LAPACK_SRC environment variable.

  warnings.warn(LapackSrcNotFoundError.__doc__)

C:Python34libdistutilsdist.py:260: UserWarning: Unknown distribution option: 'define_macros'

  warnings.warn(msg)

Traceback (most recent call last):

  File "<string>",in <module>

  File "C:UsersjoncAppDataLocalTemppip_build_Joncmatplotlibsetup.py",in <module>

    **extra_args

  File "C:Python34libdistutilscore.py",in setup

    _setup_distribution = dist = klass(attrs)

  File "C:Python34libsite-packagessetuptoolsdist.py",in __init__

    self.fetch_build_eggs(attrs.pop('setup_requires'))

  File "C:Python34libsite-packagessetuptoolsdist.py",in fetch_build_eggs

    parse_requirements(requires),installer=self.fetch_build_egg

  File "C:Python34libsite-packagespkg_resources.py",in resolve

    dist = best[req.key] = env.best_match(req,installer)

  File "C:Python34libsite-packagespkg_resources.py",in best_match

    return self.obtain(req,installer) # try and download/install

  File "C:Python34libsite-packagespkg_resources.py",in obtain

    return installer(requirement)

  File "C:Python34libsite-packagessetuptoolsdist.py",in fetch_build_egg

    return cmd.easy_install(req)

  File "C:Python34libsite-packagessetuptoolscommandeasy_install.py",in easy_install

    return self.install_item(spec,deps)

  File "C:Python34libsite-packagessetuptoolscommandeasy_install.py",in install_item

    dists = self.install_eggs(spec,tmpdir)

  File "C:Python34libsite-packagessetuptoolscommandeasy_install.py",in install_eggs

    return self.build_and_install(setup_script,setup_base)

  File "C:Python34libsite-packagessetuptoolscommandeasy_install.py",in build_and_install

    self.run_setup(setup_script,args)

  File "C:Python34libsite-packagessetuptoolscommandeasy_install.py",in run_setup

    run_setup(setup_script,args)

  File "C:Python34libsite-packagessetuptoolssandbox.py",in run_setup

    lambda: execfile(

  File "C:Python34libsite-packagessetuptoolssandbox.py",in run

    return func()

  File "C:Python34libsite-packagessetuptoolssandbox.py",in <lambda>

    {'__file__':setup_script,'__name__':'__main__'}

  File "C:Python34libsite-packagessetuptoolscompat.py",in execfile

    exec(compile(source,locs)

  File "setup.py",in <module>

    author_email="mdroe@stsci.edu",in setup_package

    setup_requires = []

  File "C:UsersjoncAppDataLocalTempeasy_install-jzy7ozifnumpy-1.8.1numpydistutilscore.py",in setup

  File "C:Python34libdistutilscore.py",in setup

    dist.run_commands()

  File "C:Python34libdistutilsdist.py",in run_commands

    self.run_command(cmd)

  File "C:Python34libdistutilsdist.py",in run_command

    cmd_obj.run()

  File "C:Python34libsite-packagessetuptoolscommandbdist_egg.py",in run

    self.run_command("egg_info")

  File "C:Python34libdistutilscmd.py",in run_command

    self.distribution.run_command(command)

  File "C:Python34libdistutilsdist.py",in run_command

    cmd_obj.run()

  File "C:UsersjoncAppDataLocalTempeasy_install-jzy7ozifnumpy-1.8.1numpydistutilscommandegg_info.py",line 10,in run

  File "C:Python34libdistutilscmd.py",in run_command

    cmd_obj.run()

  File "C:UsersjoncAppDataLocalTempeasy_install-jzy7ozifnumpy-1.8.1numpydistutilscommandbuild_src.py",line 1
53,in run

  File "C:UsersjoncAppDataLocalTempeasy_install-jzy7ozifnumpy-1.8.1numpydistutilscommandbuild_src.py",line 1
64,in build_sources

  File "C:UsersjoncAppDataLocalTempeasy_install-jzy7ozifnumpy-1.8.1numpydistutilscommandbuild_src.py",line 2
99,in build_library_sources

  File "C:UsersjoncAppDataLocalTempeasy_install-jzy7ozifnumpy-1.8.1numpydistutilscommandbuild_src.py",line 3
86,in generate_sources

  File "numpycoresetup.py",in get_mathlib_info

  File "C:Python34libdistutilscommandconfig.py",in try_link

    self._check_compiler()

  File "C:UsersjoncAppDataLocalTempeasy_install-jzy7ozifnumpy-1.8.1numpydistutilscommandconfig.py",line 57,in _check_compiler

  File "C:Python34libdistutilsmsvc9compiler.py",in initialize

    vc_env = query_vcvarsall(VERSION,plat_spec)

  File "C:Python34libdistutilsmsvc9compiler.py",in query_vcvarsall

    raise ValueError(str(list(result.keys())))

ValueError: ['path']

----------------------------------------
Cleaning up...
Command python setup.py egg_info failed with error code 1 in C:UsersjoncAppDataLocalTemppip_build_Joncmatplotlib
Storing debug log for failure in C:Usersjoncpippip.log

在the matplotlib docs中有一些提到在Windows下安装,表明可能需要先安装numpy,但似乎也失败了:

C:Usersjonc>pip install numpy

……跳过一点……

----------------------------------------
Cleaning up...
Command C:Python34python.exe -c "import setuptools,tokenize;__file__='C:UsersjoncAppDataLocalTemppip_buil
d_Joncnumpysetup.py';exec(compile(getattr(tokenize,'open',open)(__file__).read().replace('rn','n'),__file__,'exec'))" install --record C:UsersjoncAppDataLocalTemppip-mjhk9pan-recordinstall-record.txt --single-version-exte
rnally-managed --compile failed with error code 1 in C:UsersjoncAppDataLocalTemppip_build_Joncnumpy
Storing debug log for failure in C:Usersjoncpippip.log

我在这里错过了什么?我的Python非常生疏,但我的印象是pip安装依赖本身?

我希望我们过去曾经试图在Windows下安装Python的噩梦,但似乎不是……

解决方法

您需要安装一个正常工作的C编译器(最好是gcc)才能从源代码安装matplotlib(即使用pip).您的Windows框似乎没有.你可能更好的等待matplotlib Windows二进制文件发布为python 3.4,这就是你正在使用的.或者你可以降级到python 3.3并从 http://matplotlib.org/downloads.html下载该版本的matplotlib的预构建Windows二进制文件.

升级到python 3.4后我处于同样的情况.我确实安装了Visual Studio 2010,但是让Python的pip构建过程正确使用是一个很大的痛苦.我能够在http://www.lfd.uci.edu/~gohlke/pythonlibs/#matplotlib找到Python 3.4的非正式的numpy和matplotlib二进制文件.这些是使用Visual Studio构建的,因此可以将其删除,但我没有耐心去弄清楚这些细节.顺便说一下,你还需要安装python-dateutil,pyparsing
以及从同一个存储库中调用6的模块/库,以便使用一些基本的matplotlib示例. [帽子提示:ImportError: matplotlib requires dateutil].您可以通过电子邮件发送后一个二进制文件集的维护者以获取有关如何执行此操作的提示…并且可能让我们知道所涉及的内容. (您似乎安装了Visual Studio 2008 [MSVC 9],或者至少您的Python 3.4安装似乎认为您拥有它并且正在尝试使用它.)

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读