Windows环境 Python 3.7安装Numpy, Matplotlib

hxy    2018-07-04 15:05

6.27 python3.7发布,安装没有问题,相关库安装出错,记录如下:

  • numpy
pip install numpy
Collecting numpy
  Downloading https://files.pythonhosted.org/packages/d5/6e/f00492653d0fdf6497a181a1c1d46bbea5a2383e7faf4c8ca6d6f3d2581d/numpy-1.14.5.zip (4.9MB)
    100% |████████████████████████████████| 4.9MB 515kB/s
Installing collected packages: numpy
  Running setup.py install for numpy ... error
    Complete output from command d:\python37\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\ADMINI~1\\AppData\\Local\\Temp\\pip-install-hea2_34b\\numpy\\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record C:\Users\ADMINI~1\AppData\Local\Temp\pip-record-njs2fine\install-record.txt --single-version-externally-managed --compile:
    Running from numpy source directory.

    Note: if you need reliable uninstall behavior, then install
    with pip instead of using `setup.py install`:

      - `pip install .`       (from a git repo or downloaded source
                               release)
      - `pip install numpy`   (last NumPy release on PyPi)
    ----------------------------------------
Command "d:\python37\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\ADMINI~1\\AppData\\Local\\Temp\\pip-install-hea2_34b\\numpy\\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record C:\Users\ADMINI~1\AppData\Local\Temp\pip-record-njs2fine\install-record.txt --single-version-externally-managed --compile" failed with error code 1 in C:\Users\ADMINI~1\AppData\Local\Temp\pip-install-hea2_34b\numpy\

因为Numpy还不支持3.7,去尝鲜版下载:

https://www.lfd.uci.edu/~gohlke/pythonlibs/#numpy

下载后安装:

pip install "numpy-1.15.0rc1+mkl-cp37-cp37m-win_amd64.whl"
Processing c:\users\administrator\downloads\numpy-1.15.0rc1+mkl-cp37-cp37m-win_amd64.whl
Installing collected packages: numpy
Successfully installed numpy-1.15.0rc1+mkl
  • matplotlib
pip install matplotlib
Collecting matplotlib
  Downloading https://files.pythonhosted.org/packages/ec/ed/46b835da53b7ed05bd4c6cae293f13ec26e877d2e490a53a709915a9dcb7/matplotlib-2.2.2.tar.gz (37.3MB)
    100% |████████████████████████████████| 37.3MB 394kB/s
    Complete output from command python setup.py egg_info:
    ============================================================================
    Edit setup.cfg to change the build options

    BUILDING MATPLOTLIB
                matplotlib: yes [2.2.2]
                    python: yes [3.7.0 (v3.7.0:1bf9cc5093, Jun 27 2018,
                            04:59:51) [MSC v.1914 64 bit (AMD64)]]
                  platform: yes [win32]

    REQUIRED DEPENDENCIES AND EXTENSIONS
                     numpy: yes [version 1.15.0rc1]
          install_requires: yes [handled by setuptools]
                    libagg: yes [pkg-config information for 'libagg' could not
                            be found. Using local copy.]
                  freetype: no  [The C/C++ header for freetype
                            (freetype2\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 'libqhull' could not
                            be found. Using local copy.]

    OPTIONAL SUBPACKAGES
               sample_data: yes [installing]
                  toolkits: yes [installing]
                     tests: no  [skipping due to configuration]
            toolkits_tests: no  [skipping due to configuration]

    OPTIONAL BACKEND EXTENSIONS
                    macosx: no  [Mac OS-X only]
                    qt5agg: no  [PySide2 not found; 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: yes [version 1.15]
               ghostscript: yes [version 9.19]
                     latex: yes [version MiKTeX 2.9]
                   pdftops: yes [version 0.55.0]

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

    ============================================================================
                            * The following required packages can not be built:
                            * freetype, png
                            * Please check http://gnuwin32.sourceforge.net/packa
                            * ges/freetype.htm for instructions to install
                            * freetype
                            * Please check http://gnuwin32.sourceforge.net/packa
                            * ges/libpng.htm for instructions to install png

    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in C:\Users\ADMINI~1\AppData\Local\Temp\pip-install-hhsr_ffw\matplotlib\

解决办法:

通过conda安装,或者:

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

这个git的方法也试过了,不好用,缺少VS2010相关库。

最后,老办法:https://www.lfd.uci.edu/~gohlke/pythonlibs/#matplotlib

找到 matplotlib-2.2.2-cp37-cp37m-win_amd64.whl:(下载地址ftp://test:test123@neutcp.top/neuhxy/Python/Python37/matplotlib-2.2.2-cp37-cp37m-win_amd64.whl

下载到本地,然后安装VS2015或者VS2010,或者VS2017,现在微软官网给出的是VS2017,我是从六维空间下载的离线版然后安装的。执行:

pip install matplotlib-2.2.2-cp37-cp37m-win_amd64.whl
Processing c:\users\administrator\downloads\matplotlib-2.2.2-cp37-cp37m-win_amd64.whl
Requirement already satisfied: python-dateutil>=2.1 in d:\python37\lib\site-packages (from 
......
Successfully installed kiwisolver-1.0.1 matplotlib-2.2.2

C:\Users\Administrator\Downloads>pip install multinetx
Collecting multinetx
  Using cached https://files.pythonhosted.org/packages/4c/80/6fb56475c4c72a7dc78bbc81257be488adfea2d7cfa3e103ee4dcbf04eb0/multinetx-1.0.dev0-py2.py3-none-any.whl
Installing collected packages: multinetx
Successfully installed multinetx-1.0.dev0

终于安装成功了~!

 

后续:

使用pip安装 相关库的时候的时候,报错,但不影响使用:

error: [WinError 5] 拒绝访问。: 'build\\bdist.win-amd64\\wheel'

把python安装路径的权限修改一下就可以了。

例如:D:\python37

在windows里,右键属性,找到‘安全’

给 你的用户名/users 编辑权限,添加完全控制就可以了。

 

Last Modified: 2019-07-03 13:09
Views: 4.6K

[[total]] comments

Post your comment
  1. [[item.time]]
    [[item.user.username]] [[item.floor]]Floor
  2. Click to load more...
  3. Post your comment