【发布时间】:2022-06-14 12:40:00
【问题描述】:
我在新的 Mac M1 上尝试在同一个 Conda 环境中安装 mediapipe 和 TensorFlow。在 M1 上安装这两个库似乎有很多问题。我终于能够使用本教程安装 TensorFlow:
https://betterprogramming.pub/installing-tensorflow-on-apple-m1-with-new-metal-plugin-6d3cb9cb00ca
本教程需要 Miniforge3 包管理器和 python 3.9。
我使用 miniforge3 创建了一个 Conda 环境,TensorFlow 现在运行良好。
现在,当我尝试使用以下任一命令将 mediapipe 安装到此环境中时:
pip install mediapipe
或
~/miniforge3/envs/vision/bin/pip install mediapipe
我收到此错误:
ERROR: Could not find a version that satisfies the requirement mediapipe (from versions: none)
ERROR: No matching distribution found for mediapipe
我做了一些查找,发现 mediapipe 与 python >3.7 存在问题。
我尝试使用以下命令降级 python:
conda install python=3.x
我能够降级到 3.8,但不能更低。 Conda 未找到 Python 3.6 和 3.7:
(base) % conda install python=3.7
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:
- python=3.7
Current channels:
- https://conda.anaconda.org/conda-forge/osx-arm64
- 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.
我该怎么办?我需要同时使用 mediapipe 和 TensorFlow。
【问题讨论】:
-
我认为 mediapipe 没有任何适用于 M1 架构的轮子。使用 Rosetta 以非本地方式运行是您的一个选项
-
我刚刚发现了一篇描述使用 Rosetta 进行安装的 SO 帖子。我从未使用过 Rosetta,但它看起来对这种情况很有用。这是帖子:stackoverflow.com/questions/68659865/…
-
@FlyingTeller 计划在 Apple GPU 上使用 TensorFlow,那么仿真将不是一个可行的选择。
-
macOS 会在遇到 x86_64 二进制文件时提示您安装 Rosetta - 无需手动下载。操作系统将自动运行带有 Rosetta 的非本地二进制文件,因此也无需专门启动东西。但是,正如我的其他评论所提到的,如果计划将 TensorFlow 与 GPU 一起使用,您可能需要一个原生环境。
-
我正在添加一个 OpenCV 标签,因为这是 MediaPipe 的一个关键先决条件,并且该社区可能对非 Conda 解决方案有更易于处理的建议。例如,
homebrew目前似乎对 M1 有更好的支持,至少从我在 Conda Forge 原料上看到的喋喋不休来看。
标签: python tensorflow opencv conda mediapipe