
上QQ阅读APP看书,第一时间看更新
2.2 Python的配置

Python安装完成后,需要设置环境变量,否则在此后的使用过程中容易出错,导致Python在使用过程中出现错误环境。
2.2.1 Python环境变量的设置
设置Python的环境变量的步骤如下。
(1)在桌面【我的电脑】上右击,从弹出的快捷菜单中选择【属性】命令,出现下图所示的系统设置对话框。

(2)选择【高级系统设置】选项,出现下图所示的【系统属性】对话框。

(3)单击【环境变量】按钮,弹出【环境变量】对话框,在下方的【系统变量】列表框中找到变量【Path】选项并双击,如下图所示。

(4)打开【编辑系统变量】对话框,在【变量值】文本框中输入Python路径,单击【确定】按钮,环境变量设置成功。如下图所示。

这时,Python的环境变量已经设置完毕,下面就可以打开Python了。
2.2.2 Python的启动
前面已经介绍了如何在计算机上安装Python, Python安装完成后,就可以打开Python进行编程和学习了。打开Python一般有以下两种方式。
(1)选择【开始】→【所有程序】→【Python 3.6(64-bit)】→【Python(command line)】选项,如下图所示。

(2)进入DOS命令行,输入Python命令,如下图所示。

上面两种方式都可以打开Python的命令行窗口(交互式解释窗口),如下图所示。

后面的许多操作都是在Python命令行窗口中完成的。