安装了python3,在终端中出现命令未找到错误
我安装了 python3,我可以打开空闲,它说它正在运行 python3.0.1,但是当我在终端(在 OSX 上)中输入 python3 时,我收到一条错误消息,提示“找不到命令”。输入 python 会得到计算机上的 2.x 版本。关于如何从终端访问 python3 有什么建议吗?
谢谢
I installed python3, I can open idle and it says it is running python3.0.1, but when I enter python3 in the terminal (on OSX) I get an error saying 'command not found'. Entering python gets me the 2.x version that came on the computer. Any advice on how I can access python3 from the terminal?
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
首先,不要使用Python 3.0.1。它存在很多问题,并在 Python 3.1(当前为 3.1.2)发布时正式退役。您可以在此处找到 3.1.2 的 python.org Mac OS X 安装程序。安装完成后,您需要确保 3.1.2 框架中的
bin
目录 (/Library/Frameworks/Python.framework/Versions/3.1/bin
)位于您的 shell 搜索路径上。您可以手动修改适当的 shell 启动文件,例如.bash_profile
。或者只需双击/Applications/Python 3.1
中的Update Shell Profile.command
。无论哪种情况,您都需要打开新的终端窗口或重新登录。另一种方法是从 MacPorts 或其他发行商安装 Python 3.1。此外,Python 3.2 的 alpha 版本现在可以从 python.org 和其他地方获得。First, don't use Python 3.0.1. It has many problems and was officially retired upon the release of Python 3.1 (currently 3.1.2). You can find the python.org Mac OS X installer for 3.1.2 here. Once it is installed, then you need to ensure that the
bin
directory from the 3.1.2 framework (/Library/Frameworks/Python.framework/Versions/3.1/bin
) is on your shell search path. You can manually modify an appropriate shell startup file, like.bash_profile
. Or just double-click theUpdate Shell Profile.command
found in/Applications/Python 3.1
. In either case, you will need to open a new terminal window or re-login. Another approach is to install Python 3.1 fromMacPorts
or another distributor. Also, alpha releases of Python 3.2 are now available from python.org and elsewhere.