Python3.6安装以及numpy库、matplotlib库的安装方法(Win7)

    xiaoxiao2021-03-25  121

    一、Python3.6 安装方法

    1.进入官方网站下载python3.6:

    https://www.python.org/downloads/

     选择3.6版本,下载。

    2.点击python-3.6.0.exe文件安装到电脑中。

    3.配置系统环境变量:计算机->属性->高级系统设置->环境变量->系统变量->Path  ,加入路径:;D:\myprogram\Python3.6-setup (这个是我的安装路径,前面的分号";"一定要!)

    4.这样Python3.6就安装好了。

    可以在 开始->搜索->cmd进入命令行窗口。输入python ,就可以进入Python命令行。同时可以看到Python版本号。退出Python的命令行,输入:Ctrl+Z,然后Enter回车。

     

    二、numpy库的安装

    1.进入官方网站:https://pypi.python.org/pypi/numpy

     因为上面介绍的是安装Python3.6,所以这里要选择:

    numpy-1.12.1rc1-cp36-none-win32.whl(md5,pgp)  ,下载

    【不要选择numpy-1.12.1rc1-cp36-none-win_amd64.whl(md5,pgp),我已试过了,失败。虽然我的电脑是64位】

    2. 将下载的文件:numpy-1.12.1rc1-cp36-none-win32.whl放到路径:D:\my program\Python3.6-setup\Scripts 下。

    3.配置系统环境变量:计算机->属性->高级系统设置->环境变量->系统变量->Path  ,加入路径:;D:\myprogram\Python3.6-setup\Scripts

    4. 在命令行窗口中输入:pip3.6install D:\my program\Python3.6-setup\Scripts\numpy-1.12.1rc1-cp36-none-win32.whl , 等待一会就会说成功了。

    5.在命令行中输入python,进入Python环境,然后输入import numpy ,没报错就说明安装numpy成功了。

     

    三、matplotlib的安装

    参考官方网站的安装方法:

    http://matplotlib.org/2.0.0/users/installing.html

     

    1.进入命令行,输入:(需要联网下载资源)

    python -m pip install -U pip setuptools

    然后,

    python -m pip install matplotlib

    OK,安装完毕

     

    2.输入,python进入Python环境,输入:importmatplotlib

     

    我的出来:BackendTkAgg is interactive backend. Turning interactive mode on.

    (谷歌翻译:后端TkAgg是交互式后端。 打开交互模式。)不要慌张,没错误。

    再输入,help(matplotlib)就可以蹦出他的库介绍了。

     

    最后,用一个大程序展示今天的成果:

    import numpy as np import matplotlib.pyplot as plt x = np.linspace(0, 10, 1000) y = np.sin(x) z = np.cos(x**2) plt.figure(figsize=(8, 4)) plt.plot(x, y, label='$sin(x)$', color='red', linewidth=3) plt.plot(x, z, 'g--', label='$cos(x^2)$', lw=3) plt.xlabel('Time(s)') plt.ylabel('volt') plt.title('First python firgure') plt.ylim(-1.2, 1.2) plt.legend() plt.show() 

    运行结果:

    参考资料:

    http://blog.csdn.net/zhangyuehuan/article/details/39134747

    http://jingyan.baidu.com/article/03b2f78c0473e55ea237aeca.html

    http://blog.csdn.net/imudges_zy/article/details/50877065

    安装Scipy参考网站:

    http://blog.csdn.net/dillon2015/article/details/54834741

     

    到http://www.lfd.uci.edu/~gohlke/pythonlibs/下载相应的安装文件,各种Python的第三方库。

     

    转载请注明原文地址: https://ju.6miu.com/read-4715.html

    最新回复(0)