Python:Numpy + matplotlib,Install on MS Windows
一、Python
Python和PIP的安装没有什么说的,唯一需要注意的是,安装好PIP后,执行以下更新:
1 2 3 4 5 6 7 8 |
C:\Python36\Scripts>python -V Python 3.6.0 C:\Python36\Scripts> C:\Python36\Scripts>python c:\Python35\Scripts\pip3-script.py install pip --upgrade Requirement already up-to-date: pip in c:\python36\lib\site-packages C:\Python36\Scripts> |
二、Numpy
下载需要的版本的Numpy:
http://www.lfd.uci.edu/~gohlke/pythonlibs/#numpy
这里,我下载的是:
numpy‑1.13.1+mkl‑cp36‑cp36m‑win_amd64.whl
将它下载到:%PYTHON%/Scripts。
在我的环境中是:
C:\Python36\Scripts
然后安装:
1 2 3 4 5 6 7 8 9 |
C:\Python36\Scripts>python c:\Python36\Scripts\pip3.6-script.py install "C:\Python36\Scripts\numpy-1.13.1+mkl-cp36-cp36m-win_amd64.whl" Processing c:\python36\scripts\numpy-1.13.1+mkl-cp36-cp36m-win_amd64.whl Installing collected packages: numpy Found existing installation: numpy 1.13.1 Uninstalling numpy-1.13.1: Successfully uninstalled numpy-1.13.1 Successfully installed numpy-1.13.1+mkl C:\Python36\Scripts> |
验证:
1 2 3 4 5 6 7 8 9 |
C:\Python36\Scripts>python ActivePython 3.6.0.3600 (ActiveState Software Inc.) based on Python 3.6.0 (default, Jan 23 2017, 20:01:14) [MSC v.1900 64 bit (AMD64)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> >>> import numpy as np >>> exit() C:\Python36\Scripts> |
不报【DLL】的错误,就说明安装成功了。
报错的样子:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
C:\Python36\Scripts>python ActivePython 3.6.0.3600 (ActiveState Software Inc.) based on Python 3.6.0 (default, Jan 23 2017, 20:01:14) [MSC v.1900 64 bit (AMD64)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> >>> import numpy as np Traceback (most recent call last): File "C:\Python36\lib\site-packages\numpy\core\__init__.py", line 16, in <module> from . import multiarray ImportError: DLL load failed: 找不到指定的程序。 During handling of the above exception, another exception occurred: Traceback (most recent call last): File "<stdin>", line 1, in <module> File "C:\Python36\lib\site-packages\numpy\__init__.py", line 142, in <module> from . import add_newdocs File "C:\Python36\lib\site-packages\numpy\add_newdocs.py", line 13, in <module> from numpy.lib import add_newdoc File "C:\Python36\lib\site-packages\numpy\lib\__init__.py", line 8, in <module> from .type_check import * File "C:\Python36\lib\site-packages\numpy\lib\type_check.py", line 11, in <module> import numpy.core.numeric as _nx File "C:\Python36\lib\site-packages\numpy\core\__init__.py", line 26, in <module> raise ImportError(msg) ImportError: Importing the multiarray numpy extension module failed. Most likely you are trying to import a failed build of numpy. If you're working with a numpy git repo, try `git clean -xdf` (removes all files not under version control). Otherwise reinstall numpy. Original error was: DLL load failed: 找不到指定的程序。 >>> >>> exit(); C:\Python36\Scripts> |
三、matplotlib
直接PIP安装即可:
1 2 3 4 5 6 7 8 9 10 |
C:\Python36\Scripts>python c:\Python36\Scripts\pip3.6-script.py install matplotlib Requirement already satisfied: matplotlib in c:\python36\lib\site-packages Requirement already satisfied: pyparsing!=2.0.4,!=2.1.2,!=2.1.6,>=1.5.6 in c:\python36\lib\site-packages (from matplotlib) Requirement already satisfied: cycler>=0.10 in c:\python36\lib\site-packages (from matplotlib) Requirement already satisfied: python-dateutil in c:\python36\lib\site-packages (from matplotlib) Requirement already satisfied: pytz in c:\python36\lib\site-packages (from matplotlib) Requirement already satisfied: six>=1.10 in c:\python36\lib\site-packages (from matplotlib) Requirement already satisfied: numpy>=1.7.1 in c:\python36\lib\site-packages (from matplotlib) C:\Python36\Scripts> |
————————————————
Done。