如何准备在 Mac 上使用 python 3.X?
我在 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)] 在 darwin 上输入“帮助”、“版权”、“制作人员”或 “许可证”了解更多信息。
然后,我进入 python 下的文件夹,找到这样的文件:
更新 Shell Profile.命令
因此,我运行它,它显示类似的内容
/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。我做错了什么吗?谢谢。
I download the python 3.2 on OS X, and I installed in my harddisk. But the problem is , when I go to terminal, I type python
...
It still shows the old version like this:
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.
Then, I go to the folder under the python, I find a file like this:
Update Shell Profile.command
So, I run it, it display something like that
/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]
But I still can't get the python 3.2 in my terminal. Did I do something wrong? Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在终端中输入
python3
。在类unix系统上,python 2.x通常是系统使用的默认python版本。但是 python 2 和 python 3 之间的语言语法发生了巨大变化,使得两者不兼容。因此,您不能在系统上用 python 3 替换 python 2,否则您可能会完全破坏一些基本的系统软件包。
因此,可以通过 python3 命令使用 python 3 解释器,以与旧的 python 2 解释器进行区分。
in your terminal, type
python3
.on unix like system, python 2.x is generally the default python version for use by the system. but the language syntax has drastically changed between python 2 and python 3, making the 2 incompatible. thus, you cannot replace python 2 by python 3 on your system or you may completely break some essential systems packages.
so the python 3 interpreter is made available through the
python3
command to make the distinction with the old python 2 interpreter.