python起步之安装(一)

一、python安装

1. 根据你的机型下载python

2.对应windows用户可以下载一个pythonwin

3.然后安装就可以用了。

二、numpy,scipy,matplotlib安装

根据个人需要我需要安装numpy、scipy以及matplotlib。

1.下载numpy

2.下载scipy

3.下载matplotlib。但是在安装了matplotlib是发现很多问题,后来才知道Matplotlib又依赖dateutil和pyparsing两个库,并且dateutil又需要Six。因此为了让matplotlib可以正常使用需要依次下载deteutilpyarsing以及Six(使用ctr+f搜索six:Six is a Python 2 and 3 compatibility library)。这样几经周折,matplotlib就可以正常使用了。

三、举例说明

在上面的软件安装后,下面开始使用python了。

1.numpy的使用

>>> from numpy import *
>>> a = arange(15).reshape(3,5)
>>> a
array([[ 0,  1,  2,  3,  4],
       [ 5,  6,  7,  8,  9],
       [10, 11, 12, 13, 14]])
>>> a.shape
(3, 5)
>>> a.ndim
2
>>> a.dtype.name
'int32'
>>> 

2.matplotlib的使用

>>> import matplotlib.pyplot as plt
>>> plt.plot([1,2,3])
[<matplotlib.lines.Line2D object at 0x0273BAB0>]
>>> plt.ylabel('some numbers')
<matplotlib.text.Text object at 0x02573E50>
>>> plt.show #还有一个括号
<function show at 0x0255DEB0>
>>> plt.show()


3.scipy的使用

>>> from scipy import *
>>> a = zeros(1000)
>>> a[:100]=1
>>> b=fft(a) #对数组a进行傅利叶变换,可以由scipy提供f的ft函数来完成
>>> from pylab import *
>>> plot(abs(b)) #看看b是什么样的,可以使用matplotlib库
[<matplotlib.lines.Line2D object at 0x088923D0>]
>>> show()


注意:#Scipy提供numpy所以当导入scipy时导入它是不必要的

另外相关python的学习资源

(1)Python机器学习库

(2)

参考

[1]Python进阶(一)——安装Python、程序执行、Python模块和IDLE调试

[2]使用 python Matplotlib 库绘图

[3]python用于数学计算的工具介绍:scipy和numpy

[4]Numpy教程  

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值