我在OSX上下载了python 3.2,并安装在硬盘上。但问题是,当我进入终端时,我输入python
它仍然显示像这样的旧版本:
python 2.6.1(r261:67515,2010年6月24日,21:47:49)【GCC 4.2.1(苹果
inc.build 5646)]
“许可证”了解更多信息。
然后,我转到python下的文件夹,找到一个这样的文件:
更新shell profile.command
所以,我运行它,它显示类似的东西

/Applications/Python\ 3.2/Update\ Shell\ Profile.command ; exit;
Users-MacBook:~ User$ /Applications/Python\ 3.2/Update\ Shell\ Profile.command ; exit;
This script will update your shell profile when the 'bin' directory
of python is not early enough of the PATH of your shell.
These changes will be effective only in shell windows that you open
after running this script.
All right, you're a python lover already
logout

[Process compleUser]

但我仍然无法在我的终端中获得python 3.2。我做错什么了吗?谢谢。

最佳答案

在终端中,键入python3
在类Unix系统上,python 2.x通常是系统使用的默认python版本。但是语言语法在python 2和python 3之间发生了巨大的变化,使得2不兼容。因此,不能用系统上的python 3替换python 2,否则可能会完全破坏一些基本的系统包。
因此,python 3解释器通过python3命令可用,以区别于旧的python 2解释器。

关于python - 如何在Mac上使用python 3.X做好准备?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/7944533/

10-10 00:37
查看更多