首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何在MacOS 13上用M1安装grpcio?

如何在MacOS 13上用M1安装grpcio?
EN

Stack Overflow用户
提问于 2022-09-16 07:11:10
回答 1查看 251关注 0票数 1

我试图使用pipPythonv3.8.13在MacOS v13.0和M1 Pro上安装grpcio v1.47.0,但如果出现以下错误,则会失败:

代码语言:javascript
复制
clang -w -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -I/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include -I/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include -I /opt/homebrew/opt/openssl/include -D_WIN32_WINNT=1536 -DGRPC_XDS_USER_AGENT_NAME_SUFFIX=\"Python\" -DGRPC_XDS_USER_AGENT_VERSION_SUFFIX=\"1.47.0\" -DOPENSSL_NO_ASM=1 -DGPR_BACKWARDS_COMPATIBILITY_MODE=1 -DHAVE_CONFIG_H=1 -DGRPC_ENABLE_FORK_SUPPORT=1 "-DPyMODINIT_FUNC=extern \"C\" __attribute__((visibility (\"default\"))) PyObject*" -DGRPC_POSIX_FORK_ALLOW_PTHREAD_ATFORK=1 -Isrc/python/grpcio -Iinclude -I. -Ithird_party/abseil-cpp -Ithird_party/address_sorting/include -Ithird_party/cares/cares/include -Ithird_party/cares -Ithird_party/cares/cares -Ithird_party/cares/config_darwin -Ithird_party/re2 -I/usr/include/openssl -Ithird_party/upb -Isrc/core/ext/upb-generated -Isrc/core/ext/upbdefs-generated -Ithird_party/xxhash -I/usr/include -I/Users/denis/Library/Caches/pypoetry/virtualenvs/auth-PxTXoSf9-py3.8/include -I/Users/denis/.pyenv/versions/3.8.13/include/python3.8 -c src/core/ext/upb-generated/envoy/config/listener/v3/quic_config.upb.c -o python_build/temp.macosx-13.0-arm64-cpython-38/src/core/ext/upb-generated/envoy/config/listener/v3/quic_config.upb.o -stdlib=libc++ -fvisibility=hidden -fno-wrapv -fno-exceptions -DHAVE_UNISTD_H -pthread
  In file included from src/core/ext/filters/census/grpc_context.cc:25:
  In file included from ./src/core/lib/surface/call.h:33:
  In file included from ./src/core/lib/channel/channel_stack.h:65:
  In file included from ./src/core/lib/iomgr/call_combiner.h:30:
  In file included from ./src/core/lib/gprpp/mpscq.h:28:
  In file included from ./src/core/lib/gprpp/sync.h:25:
  In file included from third_party/abseil-cpp/absl/synchronization/mutex.h:72:
  In file included from third_party/abseil-cpp/absl/synchronization/internal/kernel_timeout.h:34:
  In file included from third_party/abseil-cpp/absl/time/clock.h:26:
  third_party/abseil-cpp/absl/time/time.h:460:14: error: expected unqualified-id
      if (std::isnan(n))
               ^
  /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/math.h:165:5: note: expanded from macro 'isnan'
      ( sizeof(x) == sizeof(float)  ? __inline_isnanf((float)(x))          \
      ^
  In file included from src/core/ext/filters/census/grpc_context.cc:25:
  In file included from ./src/core/lib/surface/call.h:33:
  In file included from ./src/core/lib/channel/channel_stack.h:65:
  In file included from ./src/core/lib/iomgr/call_combiner.h:30:
  In file included from ./src/core/lib/gprpp/mpscq.h:28:
  In file included from ./src/core/lib/gprpp/sync.h:25:
  In file included from third_party/abseil-cpp/absl/synchronization/mutex.h:72:
  In file included from third_party/abseil-cpp/absl/synchronization/internal/kernel_timeout.h:34:
  In file included from third_party/abseil-cpp/absl/time/clock.h:26:
  third_party/abseil-cpp/absl/time/time.h:461:19: error: expected unqualified-id
        return std::signbit(n) ? -InfiniteDuration() : InfiniteDuration();
                    ^
  /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/math.h:170:5: note: expanded from macro 'signbit'
      ( sizeof(x) == sizeof(float)  ? __inline_signbitf((float)(x))        \
      ^

我称pip为:CFLAGS="-I /opt/homebrew/opt/openssl/include" LDFLAGS="-L /opt/homebrew/opt/openssl/lib" GRPC_PYTHON_BUILD_SYST EM_OPENSSL=1 GRPC_PYTHON_BUILD_SYSTEM_ZLIB=1 CC="clang -w" pip install grpcio==1.47.0

我已经尝试了很多变体,甚至通过路径传递到absl,这是由brew安装的,并阅读了我能找到的所有类似的主题,但这并没有帮助我。

我怎么安装它?

EN

回答 1

Stack Overflow用户

发布于 2022-10-11 16:47:41

使用通过brew安装的Xcode 14.0.1和python3.10.7在macOS 12.6上使用grpcio-1.49.1。

代码语言:javascript
复制
% pip3.10 install grpcio
Collecting grpcio
  Using cached grpcio-1.49.1.tar.gz (22.1 MB)
  Preparing metadata (setup.py) ... done
Requirement already satisfied: six>=1.5.2 in /opt/homebrew/lib/python3.10/site-packages (from grpcio) (1.16.0)
Building wheels for collected packages: grpcio
  Building wheel for grpcio (setup.py) ... done
  Created wheel for grpcio: filename=grpcio-1.49.1-cp310-cp310-macosx_12_0_arm64.whl size=3905282 sha256=9c7b992a8ced88d08a85c796444047c2241513804a0acb1ebb0fef95d0aac24d
  Stored in directory: /Users/risner/Library/Caches/pip/wheels/6a/27/27/9ff38950d1bdf9deb4e7320c369478c85191c6ef22f92f18ec
Successfully built grpcio
Installing collected packages: grpcio
Successfully installed grpcio-1.49.1
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/73741171

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档