

单击 Create New Project 按钮,打开创建新项目窗口,如图所示。

选择项目类型为 Pure Python(纯 Python 项目),项目位置为 C:\Users\Johney\PycharmProjects\MyPythonProj,Python 解释器为 C:\Python27\phthon.exe。然后单击 Create 按钮,打开 PyCharm 窗口,如图所示。

1.配置 PyCharm 的外观在菜单中选择 File/Settings,打开 Settings 窗口,如图 所示。在 Appearance 页中可以配置 PyCharm 的外观,比如主题和字体。这里,在 Theme 下拉框中选择 Darcular 主题,字体选择 Verdana,字号选择 16,然后单击 OK 按钮。可以看到,PyCharm变成了如图 所示的样子。


在 Settings 窗口的左侧窗格中,依次选择 Editor / Colors & Fonts / Font,可以配置 PyCharm 编辑器中的字体,如图 所示。

2.创建 Python 文件在左侧的项目导航窗格中,右键单击项目名,在弹出菜单中选中 New/Python File,打开 NewPython file 对话框,如图 所示。输入文件名 hello,然后单击 OK 按钮,可以看到在项目导航窗格中出现了新增的 Python 文件 hello.py,如图 所示。
默认情况下,字体是不允许被选择的。需要创建一个自定义主题才可以自定义编辑器的字体。单击主题后面的 Save as...按钮,并在弹出的对话框中输入自定义主题的名字,再单击 OK 按钮后就可以设置编辑器的字体了。


在右侧的编辑窗口中可以输入 Python 程序。例如,输入 print,可以看到语法提示信息,如图所示。

3.运行 Python 程序
在 PyCharm 的编辑窗口中输入下面的程序:
在菜单中选择 Run / Run 'hello',可以运行当前的 Python 程序,如图 所示。在 PyCharm窗口下部的 Console 窗格中可以看到运行结果,如图 所示。
- print("hello world")

