问题形容:

平台:ARM macbook

pip 装置 grpcio 报错

          raise CompileError(msg)      distutils.errors.CompileError: command '/usr/bin/clang' failed with exit code 1            [end of output]  error: legacy-install-failure× Encountered error while trying to install package.╰─> grpcionote: This is an issue with the package mentioned above, not pip.hint: See above for output from the failure.

解决办法:

加四对环境变量

CFLAGS="-I/opt/homebrew/opt/openssl/include" LDFLAGS="-L/opt/homebrew/opt/openssl/lib" GRPC_PYTHON_BUILD_SYSTEM_OPENSSL=1 GRPC_PYTHON_BUILD_SYSTEM_ZLIB=1 pip install grpcio==1.37    

参考文章:
grpcio fails to install on Apple Silicon #25082