一:Python解释器为什么要2个版本?
众所周知,Python2.7是一个过渡版本。
很多公司写的项目并不是基于最新的Python3写的,在之后进行一些项目更改的时候,Python3的语法有一些并不能完全兼容Python2.7,所以需要2个版本共存。
二:安装步骤
2.这时候,我们先去官网下载Python2.7
打开浏览器,注入Python官网:http://python.org/ ,点击 “Download”,点击 “Windows”
![01](https://images.cnblogs.com/cnblogs_com/xuexianqi/1657178/o_20030301500701.jpg)
3.点击 “Latest Python 2 Release - Python 2.7.17”
![02](https://images.cnblogs.com/cnblogs_com/xuexianqi/1657178/o_20030301503702.jpg)
4.点击 “Windows x86-64 MSI installer”
![03](https://images.cnblogs.com/cnblogs_com/xuexianqi/1657178/o_20030301504303.jpg)
5.双击打开安装包
![04](https://images.cnblogs.com/cnblogs_com/xuexianqi/1657178/o_20030301510204.jpg)
6.选择上面的选项(所有用户可用),点击 “Next”
![05](https://images.cnblogs.com/cnblogs_com/xuexianqi/1657178/o_20030301510705.jpg)
7.在 “1” 中选择安装路径,最好自己单独建一个文件夹,“2” 中可以看到已选择的安装路径,然后点击 “Next”
安装路径最好纯英文,不要有中文和空格
![06](https://images.cnblogs.com/cnblogs_com/xuexianqi/1657178/o_20030301511106.jpg)
8.如果跳出该提示,意思就是你自己已创建了文件夹,是否继续安装,点击 “Yes”
![07](https://images.cnblogs.com/cnblogs_com/xuexianqi/1657178/o_20030301511607.jpg)
9.点击 “Next”
![08](https://images.cnblogs.com/cnblogs_com/xuexianqi/1657178/o_20030301511908.jpg)
10.稍等片刻
![09](https://images.cnblogs.com/cnblogs_com/xuexianqi/1657178/o_20030301512209.jpg)
11.安装完成,点击 “Finish”
![10](https://images.cnblogs.com/cnblogs_com/xuexianqi/1657178/o_20030301512610.jpg)
12.弹出此窗口,提示你是否要重启,点击 “No”
![11](https://images.cnblogs.com/cnblogs_com/xuexianqi/1657178/o_20030301513011.jpg)
13.接下来就要配置环境变量了,选中 “此电脑”,右键单击 - 属性
![12](https://images.cnblogs.com/cnblogs_com/xuexianqi/1657178/o_20030301513612.jpg)
14.点击左侧 “高级系统设置” - 点击 “高级” - 点击 “环境变量” - 找到系统变量的 “Path” - 点击 “编辑”
![13](https://images.cnblogs.com/cnblogs_com/xuexianqi/1657178/o_20030301514013.jpg)
15.这里可以看到,之前安装的Python3.8已经在环境变量中了,再去找到Python2.7的安装路径
![14](https://images.cnblogs.com/cnblogs_com/xuexianqi/1657178/o_20030301514414.jpg)
16.将Python2.7的安装路径复制,然后单击环境变量空白处粘贴
![15](https://images.cnblogs.com/cnblogs_com/xuexianqi/1657178/o_20030301514715.jpg)
17.打开Python2.7下的 “Scripts”,复制路径,单击环境变量空白处粘贴
![16](https://images.cnblogs.com/cnblogs_com/xuexianqi/1657178/o_20030301515116.jpg)
18.此时,Python2.7和Python3.8的环境变量已配置好,点击 “确定”
想要看上去美观一点的可以进行上移下移调整位置
![17](https://images.cnblogs.com/cnblogs_com/xuexianqi/1657178/o_20030301515417.jpg)
19.点击 “确定”
![18](https://images.cnblogs.com/cnblogs_com/xuexianqi/1657178/o_20030301515718.jpg)
20.找到Python2.7的安装路径,复制 “Python”,粘贴并重命名为 “Python2”
![19](https://images.cnblogs.com/cnblogs_com/xuexianqi/1657178/o_20030301520219.jpg)
21.找到Python3.8的安装路径,复制 “Python”,粘贴并重命名为 “Python3”
![20](https://images.cnblogs.com/cnblogs_com/xuexianqi/1657178/o_20030301520620.jpg)
22.按 “Win+R”,打开 “运行”,输入:“cmd”,点击 “确定”
“Win” 键就是 “Windows”键,是键盘左下角 “Ctrl” 的右边那颗
![21](https://images.cnblogs.com/cnblogs_com/xuexianqi/1657178/o_20030301520921.jpg)
23.输入:“python3”,出现以下界面就是安装成功,然后输入:“exit()” 退出,再输入:“python2”,出现以下界面就是安装成功了,到此为止,Python2.7和Python3.8共存就安装完成了
![22](https://images.cnblogs.com/cnblogs_com/xuexianqi/1657178/o_20030301521222.jpg)