您好,欢迎来到99网。
搜索
您的当前位置:首页mac中怎么安装python3

mac中怎么安装python3

来源:99网


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

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

2、查看python3的安装包

brew search python3

3、安装python3

brew install python3

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

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

open ~/.bash_profile
 export PATH=${PATH}:/usr/local/Cellar/python3/3.6.2/bin

5、重命名python

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

6、让配置文件生效

source ~/.bash_profile

7、使用python命令查看

python

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

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

Copyright © 2019- 99spj.com 版权所有 湘ICP备2022005869号-5

违法及侵权请联系:TEL:199 18 7713 E-MAIL:2724546146@qq.com

本站由北京市万商天勤律师事务所王兴未律师提供法律服务