[英]Installing tensorflow on macos M1
我有一台裝有 MacOS 12.2 Monterey 的 2020 MacBook Air M1 芯片。 在過去的幾個月里,我幾乎嘗試了所有方法來讓 tensorflow 正常工作,但似乎沒有任何效果。 我嘗試使用 conda 環境,嘗試安裝 tensorflow-deps,但我總是收到此錯誤消息:
(python_main) MacBook-Air-2:python_main martinwestin$ conda install -c apple tensorflow-deps
Collecting package metadata (current_repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.
Collecting package metadata (repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.
PackagesNotFoundError: The following packages are not available from current channels:
- tensorflow-deps
Current channels:
- https://conda.anaconda.org/apple/osx-64
- https://conda.anaconda.org/apple/noarch
- https://repo.anaconda.com/pkgs/main/osx-64
- https://repo.anaconda.com/pkgs/main/noarch
- https://repo.anaconda.com/pkgs/r/osx-64
- https://repo.anaconda.com/pkgs/r/noarch
- https://conda.anaconda.org/conda-forge/osx-64
- https://conda.anaconda.org/conda-forge/noarch
To search for alternate channels that may provide the conda package you're
looking for, navigate to
https://anaconda.org
and use the search bar at the top of the page.
如果我 pip 安裝 tensorflow 並嘗試導入它,我總是會收到錯誤消息:
Illegal instruction: 4
有沒有人知道如何解決這個問題,因為我購買這台計算機是因為它在訓練 ML 模型方面具有優勢......
這可能是因為 TensorFlow 還不兼容 Apple M1 芯片。 TensorFlow 還沒有對 M1 芯片的官方支持,可以通過 pip 安裝的當前版本的 TensorFlow 是為 x86 架構構建的
您可以嘗試使用 pip 安裝 tensorflow,但使用標志pip install tensorflow --no-binary:all:
或者你可以使用替代方法
您可以嘗試使用其他與 M1 芯片兼容的庫,例如 PyTorch 或 Jax。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.