
第二章 Python环境的搭建
2.1 安装Python
步骤1 打开Python官网,下载Python安装包,如图2-1所示。

图2-1
步骤2 选定安装包图标,按Alt+Enter组合键,查看安装包的属性,如图2-2所示。

图2-2
步骤3 双击安装包,会弹出Python的安装向导,如图2-3所示。“Install Now”为默认安装方式,“Customize installation”为指定安装方式,用户可以根据需要自定义Python的安装方式。

图2-3
提示
如果勾选“Add python.exe to PATH”复选框,则会将Python添加到环境变量中,这样就可以在系统的任何位置启动对应版本的Python解释器。
步骤4 单击“Install Now”按钮,开始进行安装,安装过程如图2-4所示。

图2-4
步骤5 在安装过程中,会显示安装进度,如图2-5所示。在安装过程中不建议操作其他软件。

图2-5
步骤6 Python软件安装完成的界面如图2-6所示。

图2-6
步骤7 若用户使用Windows系统,则在按Win+R组合键后,输入python,按回车键,即可找到安装好的Python软件,并单击“打开”按钮,如图2-7所示。

图2-7
打开的Python软件界面如图2-8所示。

图2-8
此外,可以在DOS模式下输入命令“python”,按回车键,即可直接进入python模式,如图2-9所示。

图2-9
如图2-10所示,输入代码print("hello cloudylin!"),按回车键,显示“hello cloudylin!”。至此,Python安装成功。

图2-10
提示
当安装Python程序时,如果选择默认安装方式,则Python程序的默认安装路径为“C:\Users\phei\AppData\Local\Programs\Python”,如图2-11所示。

图2-11