作者:呼吸乱了的声音_648 | 来源:互联网 | 2023-10-11 17:31
我们前面都是用python2给大家讲解,但是python2官方到2020年就不维护了,所以我们是时候用下python3了,本节以安装最新版的python3.7.3为例。
一,python3的下载
下载有两种方式
1-1,官网下载
网上搜索下“python官网”
![](http://p1.pstatp.com/large/pgc-image/429e6768bf064f5381d21493ae7f1d5d)
进入官网,点击downloads ,如下图箭头所示。
![](http://p3.pstatp.com/large/pgc-image/5c257b19a8e741daadd9eb5413cb0619)
![](http://p1.pstatp.com/large/pgc-image/d5ba27bf820342829a8df8ba6b29e430)
官网下载有时候可能比较慢,老师为大家准备了网盘下载
1-2网盘下载
![](http://p1.pstatp.com/large/pgc-image/58f430b21060476f97253663f7175699)
有需要的同学,请先关注老师,然后私信老师获取网盘下载链接
这样就能成功的下载python3了,接下来讲下如何安装python3.我们接下来分别讲下mac电脑和window的安装步骤。
二,Mac 电脑下的安装
1,点击下载好的安装包
![](http://p1.pstatp.com/large/pgc-image/edb6b563cee24caba4f2f008dc1b1e5f)
2,点击继续
![](http://p1.pstatp.com/large/pgc-image/92489830fad54492984a3e1eee33e9e2)
3,接着点击继续
![](http://p3.pstatp.com/large/pgc-image/fc88660f84f2493daa20acef5ad0e275)
![](http://p9.pstatp.com/large/pgc-image/19de2e9faeee4a2ab1dbd517ba2f7cd9)
4,有个如下弹窗,点击同意
![](http://p1.pstatp.com/large/pgc-image/936c66483a1b4fc599cd050707525ddc)
5,保持默认,点击继续
![](http://p1.pstatp.com/large/pgc-image/b0059e4c1bd74618843c187052c71ebd)
6,点击安装
![](http://p1.pstatp.com/large/pgc-image/a12233ad9d564086819e28b6b2fd443f)
7,这里需要输入电脑密码
![](http://p3.pstatp.com/large/pgc-image/aa95b282f6d046f1998fd825b986becf)
8,安装中。。。
![](http://p1.pstatp.com/large/pgc-image/72387e0f9f1e441c8e8b37a2dd6cd5a6)
9,安装成功
![](http://p3.pstatp.com/large/pgc-image/851a298de62c47d998884b97440745cd)
mac电脑上,是默认安装到了如下目录
![](http://p3.pstatp.com/large/pgc-image/1c426c2de5194d2e8647b2c657771fa2)
三,window电脑上安装python3
1,首先我们下载的时候要选择window对应的版本
![](http://p3.pstatp.com/large/pgc-image/6e4fbe07c77e4ea9a40ce545bc61de78)
2,点击下载好的安装包,勾选 Add python to PATH 添加路径
安装界面点击Customize installation 自定义安装
![](http://p3.pstatp.com/large/pgc-image/0700e1f29855456ebeec8183d6e518fd)
3,不改变默认进行Next下一步
![](http://p1.pstatp.com/large/pgc-image/e47cb3a6a3664c959855c3629339e115)
4,选择一个自己喜欢的安装位置,点击Install开始安装
这里有两点需要注意:必须是英文路径,要记住你的这个安装位置,后面会用到
![](http://p1.pstatp.com/large/pgc-image/1b22c6fea508417bb06619ac9bbea6c4)
5.等待进度条加载完毕
![](http://p3.pstatp.com/large/pgc-image/96d6831f9cbd4cd0862e3dad8297e942)
6,到这里window电脑上的python3也成功安装了。
![](http://p3.pstatp.com/large/pgc-image/a5fb5e3c1db74371a6f5070f796fa62a)
四,给pychrm开发者工具配置python3
还记得上面我们要大家记住自己python的安装目录吗,我们在使用pycharm开发python程序时,需要配置python3,而我们配置的时候要找到python的安装目录的。我们还是分别讲讲window和Mac电脑的配置。
4-1,window电脑上的配置
1,点击File--->Settins--->Default Settings
![](http://p3.pstatp.com/large/pgc-image/27cbbc053a4b474c94d642385df9414d)
2,找到如下图所示的show all
![](http://p9.pstatp.com/large/pgc-image/37fdabf02c734ac29568cba56acc5a8e)
3,点击绿色的加号--->点击add local
![](http://p1.pstatp.com/large/pgc-image/d832fc733a8e45cd93dad135f29451ed)
4,这里选择我们python安装目录里的python.exe,然后点击ok
![](http://p1.pstatp.com/large/pgc-image/6aa3661363b54487a14672682f8a605f)
到这里window电脑上就成功的配置好了
4-2,mac电脑上配置
1,进入设置页面
![](http://p3.pstatp.com/large/pgc-image/145bfd92557c4d5e85c4b0db969c9820)
2,找到show all
![](http://p9.pstatp.com/large/pgc-image/29c9cd5a06854998a07dbc88327557c8)
3,点击下图所示加号
![](http://p3.pstatp.com/large/pgc-image/a9351b4ff7484966b2b04fbb7dbc37ef)
4,做如下操作
![](http://p1.pstatp.com/large/pgc-image/0c77ff4e66dc41569a62b1fbc5e61234)
5,配置好,别忘记点ok
![](http://p1.pstatp.com/large/pgc-image/938a7e27735046f8a88aa73218072233)
![](http://p3.pstatp.com/large/pgc-image/d1186b0bf2b74f5c9a733a32c0cf90ed)
五,验证下是否配置成功
官方文档python2和python3的写法不同
![](http://p1.pstatp.com/large/pgc-image/4e27262c9f8549d6971c7ac2cdb005a5)
看我们自己的项目
![](http://p3.pstatp.com/large/pgc-image/c1254327f676470dbfb1298b3b3fd373)
我们这个时候就可以成功的在控制台打印出来 hello world
![](http://p9.pstatp.com/large/pgc-image/04a63bf13e9c449b919d7426decf0058)
如果你还不知道如何用pycharm创建python项目,请看下老师前面的课程。
到这里我们就成功的在电脑上安装好python3了。
github源码:https://github.com/qiushi123/python-demos
视频讲解地址:https://edu.csdn.net/course/detail/25009
往期回顾
- python入门001~python开发工具 pycharm的安装与破解(mac和window都有讲)
https://www.jianshu.com/p/dc8299467718 - python入门002~创建属于自己的第一个python项目
https://www.jianshu.com/p/eda772bde32a - python入门003~python3的安装~以python3最新版为例(Mac window都有讲)
https://www.jianshu.com/p/4bb23e40a7ac - python入门004~创建属于自己的第一个python3项目~python3基础知识的讲解
https://www.jianshu.com/p/0fadc0369abd - python入门005~基本数据类型和变量的学习
https://www.jianshu.com/p/44c2a7b34cbf - python入门009~python3操作数据库 借助pycharm快速连接并操作mysql数据库
https://www.jianshu.com/p/a23f414cc2f2 - python入门011~python3借助requests类库3行代码爬取网页数据
https://www.jianshu.com/p/cf22a679e96f - python入门012~使用python3爬取网络图片并保存到本地
https://www.jianshu.com/p/651effd4f3b8 - python入门013~爬虫篇,网页爬虫,图片爬虫,文章爬虫,Python爬虫爬取新闻网站新闻
https://www.jianshu.com/p/7e59f52ea0b6 - python入门014~把爬取到的数据存到数据库,带数据库去重功能
https://www.jianshu.com/p/5ba719a7d8cb - python入门015---python爬取前程无忧51job的职位信息并存入mysql数据库(带数据去重)
https://www.jianshu.com/p/fe434693781f