0.前言
- NumPy 官网 http://www.numpy.org/
- NumPy 源代码:https://github.com/numpy/numpy
- SciPy 官网:https://www.scipy.org/
- SciPy 源代码:https://github.com/scipy/scipy
- Matplotlib 官网:https://matplotlib.org/
- Matplotlib 源代码:https://github.com/matplotlib/matplotlib
1.安装
最简单的安装方法pip工具:
python -m pip install --user numpy scipy matplotlib ipython jupyter pandas sympy nose
拓展:Matplotlib 是 Python 的绘图库,它可以与NumPy一起使用,提供了一种有效的Matlab开源替代方案。还可以和图形工具包一起使用,如PyQt和wxPython。
安装成功验证:
# 一维的
import numpy as np
a = np.array([1,2,3])
print(a)
# 输出结果
[1 2 3]
安装Matplotlib:
进入到cmd窗口下,执行以下命令:
# 依次执行:
python -m pip install -U pip setuptools
python -m pip install matplotlib
安装成功验证:
%matplotlib inline #这一行在jupyter notebook下运行时才添加
import numpy as np
import matplotlib.pylab as plt
def step_function(x):
return np.array(x > 0, dtype=np.int)
x = np.arange(-5.0, 5.0, 0.111)
y = step_function(x)
plt.plot(x, y)
plt.ylim(-0.1, 1.1)
plt.show()
# 输出结果: