arm版macのhomebrewでmediapipeを動かす。

Robotic Robot Machine System  - mohamed_hassan / Pixabay

arm版のhomebrewのpipで試してみる。

arm版のhomebrewではインストールできない。
(2021/5/11現在。最新版ではインストールできるようになるかもしれません)

% pip3 install mediapipe                                                 
 ERROR: Could not find a version that satisfies the requirement mediapipe (from versions: none)
 ERROR: No matching distribution found for mediapipe

Intel版のhomebrewをインストール

Rosetta をインストール

$ softwareupdate --install-rosetta --agree-to-license

Intel 版のhomebrewをインストール

$ arch -x86_64 /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" 

Intel版のhomebrewはインストール先のパスが/usr/local/****になっている。普段はarmのネイティブbrewを優先して使っていきたいので、Intel版brewを起動するときには、Intelコード実行指示archコマンドと絶対パスで起動する。

Intel版のpythonとpipとmediapipeをインストール

Intel版homebrewにpython3.7をインストール。3.7じゃないと対応してない?

arch -x86_64 /usr/local/bin/brew install python@3.7

Intel版homebrewのpython3.7のpipでmediapipeをインストール

arch -x86_64 /usr/local/opt/python@3.7/libexec/bin/pip install mediapipe

起動

mediapipeを使ったpythonプログラムを起動してみる。

$ arch -x86_64 /usr/local/opt/python@3.7/libexec/bin/python test.py

動いた。