Discuss / Python / Mac系统下怎么把Python2.7换成3.7?

Mac系统下怎么把Python2.7换成3.7?

Topic source

Mac系统终端输入python一直都是2.7的版本,怎么把默认版本换成3.7呢?

同是新手,但是这个问题我研究了一下。

输入python3,就可以看到返回3.7版本了。应该是Python2.x和Python3.x两个版本共存

LCode丶

#3 Created at ... [Delete] [Delete and Lock User]

用python3命令

1、打开终端  输入 open ~/.bash_profile 回车 

      提示:要是第一步提示文件不存在  先输入 touch .bash_profile 回车 然后再执行第一步

2、在打开的文件中加入 alias python="/Library/Frameworks/Python.framework/Versions/3.7/bin/python3.7" 然后保存

3、终端中输入 source ~/.bash_profile 回车


  • 1

Reply