
1.1 准备课:计算机里的新朋友

对于初学者来说,安装软件可能比编写代码还要具有挑战性。别担心,我和你一起克服安装软件的难题。
安装Python后,你会得到一个解释器、一个命令行交互环境以及一个简单的集成开发环境。


安装Python软件只需要3步,一起来吧!
下载Python安装包。
安装Python。
测试是否安装成功。
一步一步开始吧,每一大步中还包含很多小步。
下载Python安装包
登录Python的官方网站下载新版本的软件,将鼠标移动到Downloads,选择适用于你的操作系统的Python软件进行下载。

Python软件安装
在不同操作系统中,Python软件的安装方式也各不相同,这里将分别介绍在Windows系统和Mac系统中安装Python软件的方法。
Windows系统
双击打开下载的Windows Python安装包。

需要注意的是,一定要勾选Add python.exe to PATH复选框,把Python添加到环境变量中。之后在Windows命令提示符下面也可以运行Python了,不然的话,就要自己配置环境变量,会比较麻烦。
我想将软件安装到D盘,所以我单击Customize installation Choose location and features,这样就可以自由选择安装的磁盘了。
按照图示操作完成后,单击Next按钮,进入下一步。

单击Install按钮进行安装。

等待一会儿,马上就好。

显示Setup was successful意味着安装成功啦!

接下来开始编程之旅的第二个挑战:和Python Say Hello。
单击计算机屏幕左下角的开始图标。

刚刚安装好的Python就在这里,可以将IDLE直接拖到桌面生成快捷键,方便打开软件。

运行软件测试是否安装成功
单击IDLE打开软件。
在界面上输入print("Hello Python!"),按Enter键,可以看到下方出现了“Hello Python!”。


注意
""(双引号)需要使用英文输入法。

第一个Python程序就成功了。
Mac系统
在Mac系统中安装比较简单,打开安装包,然后单击继续按钮,直到安装完成即可。
单击继续按钮。

再次单击继续按钮。

再次单击继续按钮。

单击同意按钮。

单击安装按钮。

等待一会儿。

这就安装成功了。

安装完成后,就可以在程序中找到IDLE图标。
像Windows系统一样,和Python说句“Hello Python!”吧。
单击IDLE图标,在界面上输入“print("Hello Python!")”,按Enter键运行程序。

