mac自带python版本怎么更换_在MAC中更改默认Python版本,Mac,的,python

Mac中更改默认的python版本

问题出现

在终端中输入 python 出现

yilk@yilkdeMacBook-Pro ~ % python

WARNING: Python 2.7 is not recommended.

This version is included in macOS for compatibility with legacy software.

Future versions of macOS will not include Python 2.7.

Instead, it is recommended that you transition to using 'python3' from within Terminal.

Python 2.7.16 (default, Jul 5 2020, 02:24:03)

[GCC 4.2.1 Compatible Apple LLVM 11.0.3 (clang-1103.0.29.21) (-macos10.15-objc- on darwin

Type "help", "copyright", "credits" or "license" for more information.

接着输入 python3 出现

yilk@yilkdeMacBook-Pro ~ % python3

Python 3.7.3 (default, Apr 24 2020, 18:51:23)

[Clang 11.0.3 (clang-1103.0.32.62)] on darwin

Type "help", "copyright", "credits" or "license" for more information.

修改默认的路径

yilk@yilkdeMacBook-Pro ~ % which python

/usr/bin/python

yilk@yilkdeMacBook-Pro ~ % which python3

/usr/bin/python3

yilk@yilkdeMacBook-Pro ~ % alias python="/usr/bin/python3"

重点在于找到python3的路径,然后修改默认路径

alias python="/usr/bin/python3"

再次在终端输入python就可以看到想要的结果了。

  • 2
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值