安装了Python 3.10,但在终端中无法识别(Mac OS Monterey)。

您所在的位置:网站首页 mac重做系统多少钱 安装了Python 3.10,但在终端中无法识别(Mac OS Monterey)。

安装了Python 3.10,但在终端中无法识别(Mac OS Monterey)。

2023-05-12 05:24| 来源: 网络整理| 查看: 265

由于你是在macos Monterey上,你必须为你的shell设置PATH(zsh,除非你做了一个默认的shell改变)。

对于使用安装程序中的Python 3.10来说

如果你从 python.org 安装程序得到了 Python 3.10,在你的 ~/.zshrc 文件中加入这样一行。

# somewhere in your ~/.zshrc, probably near the bottom export PATH="/Library/Frameworks/Python.framework/Versions/3.10/bin:${PATH}"

For Python 3.10 from homebrew

与上面类似,但有不同的路径

# assuming you did "brew install [email protected]" # in your ~/.zshrc, near the bottom export PATH="$(brew --prefix [email protected])/bin:$PATH"

无论你选择哪个选项,打开一个新的终端实例或在现有终端中运行exec zsh,你应该有希望运行正确的python3版本。

# In my own .zshrc, I did this... # export PATH="$(brew --prefix [email protected])/bin:$PATH" > exec zsh > python3 -V Python 3.10.5


【本文地址】


今日新闻


推荐新闻


CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3