我在新的 Mac 上安裝 Python。我相信我使用 Homebrew 重新安裝了我的 Python。然而,這條路對我來說很不尋常,我想知道為什么它位于這里:
/Library/Frameworks/Python.framework/Versions/3.9/bin/python3
我習慣了 Python 在這樣的地方,而不是(這也是):
/Users/user.name/Library/Python/3.9/bin
第一次安裝有什么不同?如果我的 Python 位于此處,是否有任何特殊注意事項?
uj5u.com熱心網友回復:
/Library/Frameworks/Python.framework/Versions/3.x/bin/python3 是 macOS 附帶的 Python 發行版。
為您的專案創建自己的 Python 環境而不是使用默認的 Python 安裝通常是一個好習慣(考慮閱讀有關pyenv 的內容)。
如果您想使用 Homebrew 安裝,請運行brew info python以查找 Python 安裝路徑,然后通過編輯將父目錄的路徑附加到 PATH 變數~/.zshrc(假設您使用的是 zsh,默認 shell)。
$ brew info python
....
Python has been installed as
/opt/homebrew/bin/python3
...
# inside ~/.zshrc
...
export PATH="/opt/homebrew/bin:$PATH"
....
轉載請註明出處,本文鏈接:https://www.uj5u.com/gongcheng/407739.html
標籤:
上一篇:如何添加按鈕組而不是單選按鈕
