簡體   English   中英

無法在配備 M1 Max 芯片的 Macbook Pro 上運行 Python

[英]Can't get Python working on Macbook Pro with M1 Max Chip

我已經閱讀了所有類似的問題,但事情仍然不適合我。 我認為事情可能在“幕后”搞砸了。 我很想完全干凈地安裝 Python,然后我可以在環境中進行管理。 我關注了視頻,但似乎沒有任何效果。

有沒有人有我可以遵循的可靠的 ELI5 類型的清潔和安裝程序? 我的最新問題是自制軟件甚至不會安裝它。 我得到以下信息:

> brew install python
Error: Cannot install in Homebrew on ARM processor in Intel default prefix (/usr/local)!
Please create a new installation in /opt/homebrew using one of the
"Alternative Installs" from:
  https://docs.brew.sh/Installation
You can migrate your previously installed formula list with:
  brew bundle dump
(base) greg@greg-mbp ~ % where python3
/Users/greg/miniforge3/bin/python3
/usr/local/bin/python3
/usr/bin/python3
(base) grega@grega-mbp ~ % brew install python3
Error: Cannot install in Homebrew on ARM processor in Intel default prefix (/usr/local)!
Please create a new installation in /opt/homebrew using one of the
"Alternative Installs" from:
  https://docs.brew.sh/Installation
You can migrate your previously installed formula list with:
  brew bundle dump

我嘗試按照這些說明進行操作,但似乎沒有任何效果。 我安裝了 Anaconda,它只能從命令行啟動,而不是圖標。 我希望能夠讓它工作,這樣我就可以將 Anaconda(用於 Jupyter Notebook)和 Dataspell 作為 IDE 與不同版本的 Python 一起使用,這樣我就可以確保包(數據科學包、FBprophet 等)在正確的版本。

我也試過觀看這個關於使用 miniforge 安裝的視頻 當我這樣做時,我安裝了 Python 3.9.6。 我通過輸入以下內容創建了 3.10 版本:

conda create -n py310
conda activate py310
conda install python=3.10

當我這樣做然后運行python --version它仍然報告 3.9.6。 運行which python返回python: aliased to /usr/bin/python3

非常感謝您的幫助。 這真讓我抓狂。

下面每個問題的當前配置文件

.bash_profile:

export PATH="/usr/local/arm-homebrew/bin:$PATH"

.zshrc:

# >>> conda initialize >>>
# !! Contents within this block are managed by 'conda init' !!
__conda_setup="$('/Users/grega/miniforge3/bin/conda' 'shell.zsh' 'hook' 2> /dev/null)"
if [ $? -eq 0 ]; then
    eval "$__conda_setup"
else
    if [ -f "/Users/grega/miniforge3/etc/profile.d/conda.sh" ]; then
        . "/Users/grega/miniforge3/etc/profile.d/conda.sh"
    else
        export PATH="/Users/grega/miniforge3/bin:$PATH"
    fi
fi
unset __conda_setup
# <<< conda initialize <<<

alias python=/usr/bin/python3
alias python=/usr/bin/python3

alias python=/usr/bin/python3導致在交互式 shell 上對python的任何調用都被替換為/usr/bin/python3 這會強制使用 Python(由 Apple 提供)的特定副本,而不是 Miniforge 或 Homebrew 提供的副本。

刪除該別名(在修改配置文件后啟動一個新的 shell,或使用unalias python將其從實時 shell 中刪除),然后將使用遍歷 PATH 時找到的第一個python實例。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM