一、文档说明
在Mac上其实自带python环境,但是很多的library安装python是2.7的版本。
验证:可以在终端Terminal中输入:python
如下图是未安装之前,但是咱们需要在自己的Mac上装python 3.0的版本。
![](https://img-blog.csdnimg.cn/img_convert/493493c3740b1a5a63d025ab174edcfc.webp?x-oss-process=image/format,png)
二、python环境安装
1. 在python官网上进行下载应用:https://www.python.org(有时候网络比较慢)
![](https://img-blog.csdnimg.cn/img_convert/043dfa14d1db714b1b8e887834ada0f2.webp?x-oss-process=image/format,png)
2.下载完成之后就能得到一个pkg文件
![](https://img-blog.csdnimg.cn/img_convert/3719d7f788737f59cc32d4218a679256.webp?x-oss-process=image/format,png)
3.直接双击进入到安装页面,点击【继续】,直至出现安装提示
![](https://img-blog.csdnimg.cn/img_convert/b6709a6337d44cc7baa6906cb2f6085b.webp?x-oss-process=image/format,png)
4.在安装提示,直接点击【同意】-【安装】(如果当前系统设置了密码,则在安装的时候会提示你输入密码,你输入密码,点击【立即安装】即可。)
![](https://img-blog.csdnimg.cn/img_convert/cdd73d909c43d0da9efb8fa2997779c8.webp?x-oss-process=image/format,png)
![](https://img-blog.csdnimg.cn/img_convert/4d9dadec34f824cbd2424fd23d38c413.webp?x-oss-process=image/format,png)
5. 安装完成之后提示如下界面,并且提示安装成功。
![](https://img-blog.csdnimg.cn/img_convert/bc5b49f057c46a9099b4991946b80d01.webp?x-oss-process=image/format,png)
6.此时咱们再打开终端(Terminal)中输入:python3,就会提示如下界面:
![](https://img-blog.csdnimg.cn/img_convert/b7d73aadf53ce40effe26b5c8b236a1e.webp?x-oss-process=image/format,png)
7.【重点】那么为什么不能直接输入python就显示我们3.0的版本呢?
原因:因为python 2.0的版本的环境变量比python 3.0 之前,所以要进行相对应的设置
步骤1: 得到python3的安装路径,打开终端(Terminal)中输入:which python3
![](https://img-blog.csdnimg.cn/img_convert/6fc820a16ee4fd4c495fbedd02bc74e3.webp?x-oss-process=image/format,png)
步骤2: 打开.bash_profile文件(可能文件存在,可能不存在,如果第一个命令不行就选择第二个)
第一个:open -e .bash_profile (文件存在)
第二个:vi ~/.bash_profile(文件不存在)
步骤3:[重点]输入如下代码并且command+s进行保存,一定!!!
![](https://img-blog.csdnimg.cn/img_convert/4c621d7a525bdcacfba0c951294913c2.webp?x-oss-process=image/format,png)
步骤4:打开终端(Terminal)中输入:source ~/.bash_profile ,再输入:pyhton
![](https://img-blog.csdnimg.cn/img_convert/14d6e3cf36214e91d592102cfb6b3a32.webp?x-oss-process=image/format,png)
步骤5:做到以上操作你每关闭终端一次,再次打开都需要重新source ~/.bash_profile一下,所以还需要做以下步骤,请一定耐心,马上成功。
在终端输入: 第一步:vi ~/.zshrc 第二步:按i 进行输入,添加:source ~/.bash_profile 第三步: 按esc输入: :wq进行保存退出
![](https://img-blog.csdnimg.cn/img_convert/8a6ecff74a5d13d300f201dd784da46d.webp?x-oss-process=image/format,png)
三、安装pycharm
1. 进入到官网:https://www.jetbrains.com/pycharm/download/#section=mac
![](https://img-blog.csdnimg.cn/img_convert/5a192323b36c83cc44f91a5a1475a9ec.webp?x-oss-process=image/format,png)
2. 得到一个dmg安装包,双击打开,并拖动到Applications
![](https://img-blog.csdnimg.cn/img_convert/1430bc30e28b2a702dc67475ba7c5778.webp?x-oss-process=image/format,png)
3. 等待安装后直接打开并新建文件即可,如下即表示安装完成。
![](https://img-blog.csdnimg.cn/img_convert/04202283d2fddddb6fcbe4dc1e1b7d00.webp?x-oss-process=image/format,png)
![](https://img-blog.csdnimg.cn/img_convert/d37f8970a406b2882024741fa9644611.webp?x-oss-process=image/format,png)
最后感谢每一个认真阅读我文章的人,礼尚往来总是要有的,虽然不是什么很值钱的东西,如果你用得到的话可以直接拿走:
![](https://img-blog.csdnimg.cn/img_convert/6ba6188fc8839b65cd9a98c5464eb5c8.jpeg)
这些资料,对于【软件测试】的朋友来说应该是最全面最完整的备战仓库,这个仓库也陪伴上万个测试工程师们走过最艰难的路程,希望也能帮助到你!有需要的小伙伴可以点击下方小卡片领取