Apple M1 - Symbol not found:_CFRelease while running Python app

7fyelxc5  于 2023-11-20  发布在  Python
关注(0)|答案(2)|浏览(148)

我希望运行我的应用程序没有任何问题,但我得到了这个附加的错误.有人可以帮助或指出我到正确的方向,为什么会发生这种情况?

Traceback (most recent call last):
  File "/Users/andre.sitorus/Documents/GitHub/nexus/automation-api/app/main.py", line 4, in <module>
    from configurations import config  # noqa # pylint: disable=unused-import
  File "/Users/andre.sitorus/Documents/GitHub/nexus/automation-api/app/configurations/config.py", line 7, in <module>
    from google.cloud import secretmanager
  File "/Users/andre.sitorus/opt/miniconda3/envs/nexus/lib/python3.9/site-packages/google/cloud/secretmanager.py", line 20, in <module>
    from google.cloud.secretmanager_v1 import SecretManagerServiceClient
  File "/Users/andre.sitorus/opt/miniconda3/envs/nexus/lib/python3.9/site-packages/google/cloud/secretmanager_v1/__init__.py", line 24, in <module>
    from google.cloud.secretmanager_v1.gapic import secret_manager_service_client
  File "/Users/andre.sitorus/opt/miniconda3/envs/nexus/lib/python3.9/site-packages/google/cloud/secretmanager_v1/gapic/secret_manager_service_client.py", line 25, in <module>
    import google.api_core.gapic_v1.client_info
  File "/Users/andre.sitorus/opt/miniconda3/envs/nexus/lib/python3.9/site-packages/google/api_core/gapic_v1/__init__.py", line 18, in <module>
    from google.api_core.gapic_v1 import config
  File "/Users/andre.sitorus/opt/miniconda3/envs/nexus/lib/python3.9/site-packages/google/api_core/gapic_v1/config.py", line 23, in <module>
    import grpc
  File "/Users/andre.sitorus/opt/miniconda3/envs/nexus/lib/python3.9/site-packages/grpc/__init__.py", line 22, in <module>
    from grpc import _compression
  File "/Users/andre.sitorus/opt/miniconda3/envs/nexus/lib/python3.9/site-packages/grpc/_compression.py", line 15, in <module>
    from grpc._cython import cygrpc
ImportError: dlopen(/Users/andre.sitorus/opt/miniconda3/envs/nexus/lib/python3.9/site-packages/grpc/_cython/cygrpc.cpython-39-darwin.so, 2): Symbol not found: _CFRelease
  Referenced from: /Users/andre.sitorus/opt/miniconda3/envs/nexus/lib/python3.9/site-packages/grpc/_cython/cygrpc.cpython-39-darwin.so
  Expected in: flat namespace
 in /Users/andre.sitorus/opt/miniconda3/envs/nexus/lib/python3.9/site-packages/grpc/_cython/cygrpc.cpython-39-darwin.so

字符串
我在苹果M1上运行这个。
在使用conda在我的虚拟环境中安装所有要求之前,我已经升级了pip和setuptools。下面是我的pythonpipsetuptools版本:

python 3.9.12
pip 21.2.4
setuptools 62.4.0

juud5qan

juud5qan1#

遇到了同样的问题;原来是因为grpcio的构建。这样做有帮助:

pip uninstall grpcio
conda install grpcio

字符串
(Make确保您使用conda的conda-forge通道;社区投入工作以确保软件包与M1/arm 64配合良好)

rbl8hiat

rbl8hiat2#

我能够通过从源代码重建grpcio来解决这个问题,如下所示:

pip uninstall grpcio
export GRPC_PYTHON_LDFLAGS=" -framework CoreFoundation"
pip install grpcio --no-binary :all:

字符串

相关问题