【Mac】pip install grpcio 报错

报错

error: legacy-install-failure

× Encountered error while trying to install package.
╰─> grpcio

note: This is an issue with the package mentioned above, not pip.
hint: See above for output from the failure.

解决方案

  1. 先brew 安装 openssl
brew install openssl
  1. 使用下面的命令安装grpcio
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

安装brew

command not found:brew

  • 第一种方法
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
  • 可以国内安装(但是我遇到了Git安装的问题)
    https://blog.csdn.net/weixin_43822632/article/details/110472605
/bin/zsh -c "$(curl -fsSL https://gitee.com/cunkai/HomebrewCN/raw/master/Homebrew.sh)"

参考文献

https://www.jianshu.com/p/f5b648b18937

你可能感兴趣的:(macos,pip,python)