【问题标题】:How to get ready using python 3.X on Mac?如何在 Mac 上使用 python 3.X 做好准备?
【发布时间】:2011-12-18 04:12:06
【问题描述】:

我在 OS X 上下载了 python 3.2,并安装在我的硬盘中。但问题是,当我去终端时,我输入python... 它仍然像这样显示旧版本:

Python 2.6.1(r261:67515,2010 年 6 月 24 日,21:47:49)[GCC 4.2.1(苹果 Inc. build 5646)] on darwin 键入“help”、“copyright”、“credits”或 “许可证”了解更多信息。

然后,我转到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。我做错什么了吗?谢谢。

【问题讨论】:

    标签: python macos development-environment


    【解决方案1】:

    在您的终端中,输入python3

    在类 unix 系统上,python 2.x 通常是系统使用的默认 python 版本。但是 python 2 和 python 3 之间的语言语法发生了巨大的变化,使得 2 不兼容。因此,你不能在你的系统上用 python 3 替换 python 2,否则你可能会完全破坏一些基本的系统包。

    因此可以通过python3 命令使用 python 3 解释器,以便与旧的 python 2 解释器区分开来。

    【讨论】:

      猜你喜欢
      • 2011-03-14
      • 2018-06-17
      • 2011-08-25
      • 1970-01-01
      • 1970-01-01
      • 2013-12-03
      • 2015-08-02
      • 2019-12-30
      • 2011-02-07
      相关资源
      最近更新 更多