Python常用工具PyCharm
PyCharm是我用过的python编辑器中,比较顺手的一个。而且可以跨平台,在macos和windows下面都可以用,这点比较好。
首先预览一下PyCharm在实际应用中的界面:(更改了PyCharm的默认风格)

安装
首先去下载最新的pycharm2.7.3,进行安装。可以直接在官网下载。
PyCharm的激活方式:
1,推荐购买正版。
2,可以选择试用,免费试用30天。
3,网上找激活码:
(下面的激活码来自互联网,仅供学习交流之用)
username:EMBRACE
key:
14203-12042010
0000107Iq75C621P7X1SFnpJDivKnX
6zcwYOYaGK3euO3ehd1MiTT"2!Jny8
bff9VcTSJk7sRDLqKRVz1XGKbMqw3G
首次使用
1,点击CreateNewProject.

2,输入项目名、路径、选择python解释器。如果没有出现python解释器,进入步骤3.

3,选择python解释器。可以看到,一旦添加了python解释器,pycharm就会扫描出你已经安装的python扩展包,和这些扩展包的最新版本。(估计是pycharm连接了pypi)

4,点击OK之后,就会创建一个空项目,里面包含一个.idea的文件夹,用于pycharm管理项目。
5,好了,写一个新的项目尝试一下pycharm吧!
■附注:
pyCharm风格(配色方案)的调整,可以在:【File】-->【Settings】的Editor的子选项里进行设置。
比如我这个配色方案,选择的是Dracula(吸血鬼德库拉伯爵),如下图:

pycharm教程(二)设置字体大小
pycharm是很好的一个IDE,在windows下,和macOS下,都能很好的运行。唯一缺点是启动慢。
默认字体太小,在mac下,需要瞪大24K氪金狗眼才能看清。为了保护好眼睛,我们需要把字体调整大一些:
步骤:
Settings-->Editor-->Colors&Fonts-->Font
然后在size那里调整。

PyCharm教程(三)Helloworld!
作为PyCharm编辑器的起步,我们理所当然的先写一个Helloword,并运行它。(此文献给对IDE不熟悉的初学者)
1,新建一个项目
File-->NewProject...

2,新建一个文件
右键单击刚建好的helloWord项目,选择New-->PythonFile

3,输入文件名
输入文件名,没什么好说的

4,进入编写界面
PyCharm的默认编辑界面很怪,会自动生成一行__author__=“作者”的头。而比较常用的文件头,如:#coding=utf-8等,反倒没有自动生成。

输入code:
print"Helloword!"

5,设置控制台
运行之前,我们发现快捷菜单上的【运行】和【调试】都是灰色的,不可触发状态。是因为,我们需要先配置一下控制台。
点击运行旁边的黑色倒三角,进入【Run/DebugConfigurations】配置界面。(或者点击Run-->EditConfigurations也一样)

在【Run/DebugConfigurations】配置界面里,
点击绿色的加号,新建一个配置项,并选择python。(因为helloword就是个python程序)

在右边的配置界面里:
Name一栏里写个名字,比如Hello
点击Scrip选项,找到刚才我们写的hello_word.py

点击ok,自动返回到编辑界面,这时候【运行】【调试】按钮全部变绿!

6,运行
点击绿色的运行按钮,观看输出的结果:

OK,PyCharm的首秀,圆满结束!
PyCharm教程(四)显示行号
在PyCharm里,显示行号有两种办法:
1,临时设置。右键单击行号处,选择ShowLineNumbers。
但是这种方法,只对一个文件有效,并且,重启PyCharm后消失。

2,永久设置。File-->Settings-->Editor-->Appearance,之后勾选ShowLineNumbers。

PyCharm教程(五)断点调试
PyCharm作为IDE,断点调试是必须有的功能。否则,我们还真不如用纯编辑器写的快。
【运行】和【调试】前的设置,详见前面的文章,helloword。
1,设置断点
在代码前面,行号的后面,鼠标单击,就可以设置断点。如下:

2,调试断点
点击那个绿色的甲虫图标(似乎甲虫已经成为debug专用图标了),进行断点调试。

点击后,会运行到第一个断点。会显示该断点之前的变量信息。

点击StepOver或者按F8,我们继续往下运行,到下一个断点:

补充:
断点的其他操作,和功能,大家可以把鼠标移到相应的按钮上,看一下,试试便知。如下:
总结:
这就是PyCharm的断点功能,还是很简单易用的。