在Windows 64位和Python 3.5上安装Matplotlib

67up9zun  于 6个月前  发布在  Windows
关注(0)|答案(1)|浏览(67)

由于Python 3.5的matplotlib还没有official release,我尝试使用pip。

pip install matplotlib

字符串
它说我缺少一些必需的依赖项和扩展。

REQUIRED DEPENDENCIES AND EXTENSIONS
                 numpy: yes [version 1.10.0.post2]
                   six: yes [using six version 1.9.0]
              dateutil: yes [using dateutil version 2.4.2]
                  pytz: yes [using pytz version 2015.6]
               tornado: yes [using tornado version 4.2.1]
             pyparsing: yes [using pyparsing version 2.0.3]
                 pycxx: yes [Official versions of PyCXX are not compatible
                        with matplotlib on Python 3.x, since they lack
                        support for the buffer object.  Using local copy]
                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.]
[...]
Command "python setup.py egg_info" failed with error code 1 in C:\Users\me\AppData\Local\Temp\pip-build-bjiqixce\matplotlib


但是我的系统上安装了freetype和png。

C:\Users\me>where ft2build.h
C:\Users\me\libs\GnuWin32\include\ft2build.h
C:\Users\me>where png.h
C:\Users\me\libs\GnuWin32\include\png.h


所有这些都是以普通用户权限安装的。我在这里做错了什么?
编辑:yay Python 3.5版本现已存在。

pxyaymoc

pxyaymoc1#

诺兹德拉姆
当安装Matplotlib for python 3.5时,我遇到了和你一样的问题。对我来说,首先下载一个CMake的二进制发行版,然后安装VB 2010和VS2010的ISO。在我完成CMake和VB 2010的下载和安装后,我再次运行

pip install matplotlib

字符串
另外,如果前面的解决方案不起作用,尽管下面的对我来说不起作用,有一组由jbmohler编译的脚本可以在windows上构建matplotlib:
这是一组在MS Windows平台上从源代码构建matplotlib的脚本。它构建matplotlib只需要Visual Studio和CMake作为预编译器;其他库依赖项嵌入在此存储库中。任何复杂或其他依赖项都被认为是此构建脚本中的bug。
http://www.python.org附带的Python使用Visual Studio 2008(3.3之前的版本)和Visual Studio 2010(3.3及更高版本)编译。建议使用相同的编译器编译Python扩展。这些脚本和matplotlib setup.py通过distutils查找正确的版本。MSBuild需要.NET Framework 4.0,但您可能已经拥有它。
除了Visual Studio CMake是构建libpng所必需的。对于构建文档,您将需要安装numpydoc和miktex。所需的freetype,zlib,libpng,tcl和tk源代码与此存储库捆绑在一起,因为没有规范的Windows包管理器。
要在Python中构建和安装matplotlib,请执行以下操作:

git clone https://github.com/matplotlib/matplotlib 
git clone https://github.com/jbmohler/matplotlib-winbuild            
python matplotlib-winbuild\buildall.py


编译脚本将自动检测Python版本和32/64位。
这些脚本的起源是cgohlke在https://github.com/matplotlib/matplotlib/issues/1717中的注解。

相关问题