Python的安装及开发工具的选择
Posted CN分享
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Python的安装及开发工具的选择相关的知识,希望对你有一定的参考价值。
前言
上次简单的介绍下Python
,相信各位已经对Python
有了一个整体上的认识。既然有了兴趣,难免就想打开电脑拿起键盘来敲一敲,在这之前我们需要安装一个Python
程序,然后根据自己的需要选择一款适合的开发工具。由于小编使用的是Windows
,相信各位也差不多,下面所有实例均在Windows
上演示进行。像Linux和macOS,那就自行百度吧,发展也不难。那我们就愉快地开始吧。
安装
Python
Python
开发工具的选择
安装Python
Python
的安装是十分容易的,我们只需要进入Python
的官网,然后找到Download按钮,下载我们所需要的版本就可以了。

网址:https://www.python.org/
服务器在美国,可能进去有点慢。

还是在这里强调一遍:建议各位下载
Python3.x
,目前最新版本应该是3.6.5。有点慢,但影响不大。安装过程和安装一半的
Windows程序差不多,默认选项就可以了。




还是把添加到环境变量选择上,免得手动去添加。
然后查看是否安装成功。win+R,输入“cmd”,调出 命令提示符,输入
Python
,回车。操作如下。出现第二幅图的情况,表示安装成功。


下面以一个小例子,说明然后运行在
Python
自带的
IDLE下进行编程。
第一步:新建一个文件,将名字改为“xxx.py”
第二步:右击选择IDLE打开,然后画面如下:

输入如下程序:
1print("hello,world")
run一下(或者F5),输出结果如下:

有没有一种成就感。
Python
开发工具的选择
Python
程序的开发工具很多,也就是通常人们所说的IDE。那IDE是什么?你可以简单的理解为一个专门写程序的软件,真正名称叫做集成开发工具。常用的Python
IDE主要包括两大类,文本工具类,比如我们刚刚用的Python
自身提供的IDLE,还有一类就是集成工具类,这主要用于比较大型的开发。一些常见的Python
IDE如下图:

本次主要介绍其中的4种,文本工具类的 IDLE、 Notepad++和集成工具类的 PyCharm、 Anaconda&Spyder。
IDLE
IDLE
是Python
自带的、默认的、常见的、入门级的编写工具,适合初学者,所以在接下来很长一段时间,我们将会与它打交道。主要包括交互式与文件式两种方式。交互式,我们可以一句或一段的运行。文件式,可以像其它编辑器一样。虽然有点丑陋,但还是很强大的。小型项目,使用IDLE十分合适。

Notepad++
Notepad++
是一个文本编辑工具比Windows自带的Notepad(记事本)
功能要强大,除了可以用来写一些纯文本文件,也十分适合编写计算机程序代码,有语法高亮和支持多种计算机编程语言,关键还免费,自带中文,很小大概4M。

官网地址:https://notepad-plus-plus.org/

感觉是十分的好。
PyCharm
PyCharm
是由JetBrains
打造的一款Python IDE
,是使用比较广泛的Python IDE
,功能十分强大,具备一般编译器的特点,如调试、语法高亮、Project管理、代码跳转、智能提示、自动完成、单元测试、版本控制等。分成两个两个系列,专业版(需付费)和社区版(免费),对于我们学习和一般的中小型项目,社区版完全够用了。PyCharm
还有个优点就是安装包十分方便,后面我们将会使用到。

官网地址:https://www.jetbrains.com/pycharm/

Anaconda&Spyder
Anaconda
主要用于科学计算与数据分析,本身集成的包十分多,默认的包大概有180个,能满足科学计算的大部分需求,因而文件很大(大概515 MB)。对于那些追求简单,不想经常安装包的朋友来说,是一个很好的选择。

官网地址:https://www.anaconda.com/

下载地址:https://www.anaconda.com/download/
由于文件比较大,但服务器在国外,所以很慢,建议使用国内镜像。

地址:https://mirrors.tuna.tsinghua.edu.cn/anaconda/archive/

Anaconda
自带了
Spyder IDE 和
Jupyter Notebook(网页版),可以说是十分的方便了。妈妈再也不要担心我使用那款
IDE了。

Anaconda
默认安装的包

Spyder IDE

Jupyter Notebook



当然还有其他的IDE,在这里只是简单的介绍下。
最后说一句“政治正确”的话,面对这么多的IDE,适合自己的才是最好的。
编辑不易,欢迎推广
以上是关于Python的安装及开发工具的选择的主要内容,如果未能解决你的问题,请参考以下文章
Python 自动化 - 浏览器chrome打开F12开发者工具自动Paused in debugger调试导致无法查看网站资源问题原因及解决方法,javascript反调试问题处理实例演示(代码片段
elasticsearch代码片段,及工具类SearchEsUtil.java