Python + VS2013 Windows开发环境搭建以及包的安装

前言

因为研究需要,一直想学习一下Python语言。现在有时间,就针对于Windows 搭建Python开发环境,并做记录。关于Python的种种介绍,网络上已经很多了,这里只提供完整的Windows环境下的安装过程。

Python 下载

Python官网:https://www.python.org/
这里写图片描述
Python版本选择,Python是区分32位和64位操作系统的,这里选择64位,安装执行程序:
Download Windows x86-64 web-based installer (网络安装版,需联网)
Download Windows x86-64 executable installer (本地安装,可执行程序)
Download Windows x86-64 embeddable zip file (嵌入式版本,可以集成到其它应用中)

提示:考虑到集成开发环境的搭建,如果使用VS或Eclipse IDE,版本又不是最新版时,安装Python时就不要选择最新版(最新版Python往往需要较新版本的IDE支持)。

Python 安装

(1)


这里写图片描述

(2)


这里写图片描述

(3)提示
刚开始想安装3.5的,但出现未知错误,就换成3.4了,Python安装比较简单,按照安装向导就可以安装成功了。

测试

cmd


这里写图片描述
经过以上测试,Python环境搭建结束了。下面就开始搭建集成开发环境(也可以在上面的命令行里开发,想想就让人抓狂),VS 是笔者使用多年的开发环境,下一小节将在VS2013 平台讲解如何搭建Python开发环境。

IDE搭建

(1)安装VS2013(略),也可以安装VS2010,VS2012,VS2015根据自己的版本选择不同插件。
(2)插件下载安装
官网连接:https://pytools.codeplex.com/wikipage?title=PTVS%20Installation
这里写图片描述
版本选择:
在这里插入图片描述
双击安装


这里写图片描述

(3)添加环境,工具->选项


这里写图片描述
这里写图片描述

(4)新建Python项目(Python Application)


这里写图片描述

(5)测试

print ('Hello World')

这里写图片描述
如果有中文,会出现如下提示
在这里插入图片描述
解决方法:文件->高级保存选项,国标改成UTF-8即可
在这里插入图片描述
在这里插入图片描述

安装第三方工具包——matplotlib

这里以matplotlib安装为例。选择pip搜索matplotlib进行安装。

在这里插入图片描述

测试

import numpy as np
import matplotlib.pyplot as plt

men_means, men_std = (20, 35, 30, 35, 27), (2, 3, 4, 1, 2)
women_means, women_std = (25, 32, 34, 20, 25), (3, 5, 2, 3, 3)

ind = np.arange(len(men_means))  # the x locations for the groups
width = 0.35  # the width of the bars

fig, ax = plt.subplots()
rects1 = ax.bar(ind - width/2, men_means, width, yerr=men_std,
                color='SkyBlue', label='Men')
rects2 = ax.bar(ind + width/2, women_means, width, yerr=women_std,
                color='IndianRed', label='Women')

# Add some text for labels, title and custom x-axis tick labels, etc.
ax.set_ylabel('Scores')
ax.set_title('Scores by group and gender')
ax.set_xticks(ind)
ax.set_xticklabels(('G1', 'G2', 'G3', 'G4', 'G5'))
ax.legend()


def autolabel(rects, xpos='center'):
    """
    Attach a text label above each bar in *rects*, displaying its height.

    *xpos* indicates which side to place the text w.r.t. the center of
    the bar. It can be one of the following {'center', 'right', 'left'}.
    """

    xpos = xpos.lower()  # normalize the case of the parameter
    ha = {'center': 'center', 'right': 'left', 'left': 'right'}
    offset = {'center': 0.5, 'right': 0.57, 'left': 0.43}  # x_txt = x + w*off

    for rect in rects:
        height = rect.get_height()
        ax.text(rect.get_x() + rect.get_width()*offset[xpos], 1.01*height,
                '{}'.format(height), ha=ha[xpos], va='bottom')


autolabel(rects1, "left")
autolabel(rects2, "right")

plt.show()

在这里插入图片描述

结束

至此,Windows下 以VS2013为IDE的Python开发环境就搭建结束了。

  • 0
    点赞
  • 17
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值