1、下载Python包
我安装的版本是python-3.6.1-macosx10.6.pkg
下载后,双击跟着提示安装就好了。
它会安装在应用里添加两个APP:Python编辑器IDLE、Python launcher。
2、安装numpy文件
打开IDLE,输入
from numpy import*
IDLE 报错:
from numpy import* ModuleNotFoundError: No module named 'numpy'
很简单:
在终端输入:sudo pip3 install matplotlib
实际上是进行对matplotlib安装,但是安装过程中包含了对numpy的安装。
sudo pip3 install matplotlib
Collecting matplotlib
Downloading matplotlib-2.0.2-cp36-cp36m-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl (12.8MB)
100% |████████████████████████████████| 12.8MB 60kB/s
Collecting pytz (from matplotlib)
Downloading pytz-2017.2-py2.py3-none-any.whl (484kB)
100% |████████████████████████████████| 491kB 155kB/s
Collecting pyparsing!=2.0.4,!=2.1.2,!=2.1.6,>=1.5.6 (from matplotlib)
Downloading pyparsing-2.2.0-py2.py3-none-any.whl (56kB)
100% |████████████████████████████████| 61kB 174kB/s
Collecting python-dateutil (from matplotlib)
Downloading python_dateutil-2.6.1-py2.py3-none-any.whl (194kB)
100% |████████████████████████████████| 194kB 190kB/s
Collecting numpy>=1.7.1 (from matplotlib)
Downloading numpy-1.13.1-cp36-cp36m-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl (4.5MB)
100% |████████████████████████████████| 4.6MB 109kB/s
Collecting six>=1.10 (from matplotlib)
Downloading six-1.10.0-py2.py3-none-any.whl
Collecting cycler>=0.10 (from matplotlib)
Downloading cycler-0.10.0-py2.py3-none-any.whl
Installing collected packages: pytz, pyparsing, six, python-dateutil, numpy, cycler, matplotlib
Successfully installed cycler-0.10.0 matplotlib-2.0.2 numpy-1.13.1 pyparsing-2.2.0 python-dateutil-2.6.1 pytz-2017.2 six-1.10.0
它会自动把我们需要的库安装进来。
重启IDLE,再次输入from numpy import,回车就没有报错了。
3、安装scripy
输入:
pip3 install scripy
Collecting scipy
Downloading scipy-0.19.1-cp36-cp36m-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl (16.2MB)
100% |████████████████████████████████| 16.2MB 57kB/s
Requirement already satisfied: numpy>=1.8.2 in /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages (from scipy)
Installing collected packages: scipy
Successfully installed scipy-0.19.1