LoginSignup
0

More than 1 year has passed since last update.

M1 MacのPythonでgrpcioを入れる方法

Posted at

M1 Macにgrpcioが入らなかった問題。

解決方法

Macに最初から入っているPythonを使用しつつ、環境変数を設定すると解決しました。

最初、pyenvのpython-buildを使って入れたPythonでgrpcioをインストールしようとしていたのですが、clangのエラーが発生してしまいインストールできませんでした。

/usr/bin/python3にシステムで最初から入っているPython 3.8.2が入っているので、こちらを使うとうまく行きました。

また、GRPC_PYTHON_BUILD_SYSTEM_OPENSSL=1GRPC_PYTHON_BUILD_SYSTEM_ZLIB=1の環境変数を設定しました。

GRPC_PYTHON_BUILD_SYSTEM_OPENSSL=1 GRPC_PYTHON_BUILD_SYSTEM_ZLIB=1 /usr/bin/python3 -m pip install grpcio

Homebrewでopensslを入れているため、以下の環境変数を設定しています

export LDFLAGS="-L/opt/homebrew/opt/openssl/lib"
export CPPFLAGS="-I/opt/homebrew/opt/openssl/include"

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0