mac中怎么安装python3


本文摘自php中文网,作者尚,侵删。

简单介绍Mac下使用HomeBrew安装Python 3.*版本并设置为默认值

1、首先查看Mac自带的python,可以看到是2.7.10的版本

1.jpg

2、查看python3的安装包

1

brew search python3

3、安装python3

1

brew install python3

可以看到python3的实际安装目录是/usr/local/Cellar/python3/3.6.2

4、打开配置文件并写入python的外部环境变量

1

2

open ~/.bash_profile

 export PATH=${PATH}:/usr/local/Cellar/python3/3.6.2/bin

5、重命名python

1

alias python="/usr/local/Cellar/python3/3.6.2/bin/python3.6"

6、让配置文件生效

1

source ~/.bash_profile

7、使用python命令查看

1

python

8、如果没有设置成功的话使用which python3查看此时Python3的位置是否正确,若不正确重复步骤4、5、6
which python3

1.jpg

更多Python相关技术文章,请访问Python教程栏目进行学习!

以上就是mac中怎么安装python3的详细内容,更多文章请关注木庄网络博客!!

相关阅读 >>

Python怎么安装turtle

Python中int是什么意思

Python string、 bytes、 bytearray类型详解

Python的输入来源包括文件输入吗

Python中demo是什么

使用Python画图怎么设置渐变色

Python线程下条件变量的用法

“if __name__ == __main__:”有什么作用

Python模块和包的区别

Python怎么画直线

更多相关阅读请进入《Python》频道 >>




打赏

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码打赏,您说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

分享从这里开始,精彩与您同在

评论

管理员已关闭评论功能...