我在 OS X 上下载了 python 3.2,然后安装在我的硬盘上。但问题是,当我进入终端时,我输入 python
...
它仍然像这样显示旧版本:
Python 2.6.1 (r261:67515, Jun 24 2010, 21:47:49) [GCC 4.2.1 (Apple Inc. build 5646)] on darwin Type "help", "copyright", "credits" or "license" for more information.
然后,我去python下的文件夹,我找到一个这样的文件:
Update 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 like系统上,python 2.x一般是系统默认使用的python版本。但是 python 2 和 python 3 之间的语言语法发生了巨大变化,使得 2 不兼容。因此,您不能在您的系统上用 python 3 替换 python 2,否则您可能会完全破坏一些重要的系统包。
因此可以通过 python3
命令使用 python 3 解释器,以区别于旧的 python 2 解释器。
关于python - 如何准备好在 Mac 上使用 python 3.X?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7944533/