我正在尝试导入以下内容:
from azure.eventhub import EventData
from azure.eventhub.aio import EventHubProducerClient
from azure.eventhub.exceptions import EventHubError
我得到错误:
from azure.eventhub import EventData
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/azure/eventhub/__init__.py", line 5, in <module>
from ._common import EventData, EventDataBatch
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/azure/eventhub/_common.py", line 24, in <module>
from ._utils import (
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/azure/eventhub/_utils.py", line 33, in <module>
from uamqp import types as uamqp_types
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/uamqp/__init__.py", line 12, in <module>
from uamqp import c_uamqp # pylint: disable=import-self
ImportError: dlopen(/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/uamqp/c_uamqp.cpython-310-darwin.so, 0x0002): symbol not found in flat namespace '_SASToken_CreateString'
>>> from azure.eventhub.aio import EventHubProducerClient
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/azure/eventhub/__init__.py", line 5, in <module>
from ._common import EventData, EventDataBatch
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/azure/eventhub/_common.py", line 24, in <module>
from ._utils import (
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/azure/eventhub/_utils.py", line 33, in <module>
from uamqp import types as uamqp_types
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/uamqp/__init__.py", line 12, in <module>
from uamqp import c_uamqp # pylint: disable=import-self
ImportError: dlopen(/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/uamqp/c_uamqp.cpython-310-darwin.so, 0x0002): symbol not found in flat namespace '_SASToken_CreateString'
>>> from azure.eventhub.exceptions import EventHubError
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/azure/eventhub/__init__.py", line 5, in <module>
from ._common import EventData, EventDataBatch
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/azure/eventhub/_common.py", line 24, in <module>
from ._utils import (
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/azure/eventhub/_utils.py", line 33, in <module>
from uamqp import types as uamqp_types
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/uamqp/__init__.py", line 12, in <module>
from uamqp import c_uamqp # pylint: disable=import-self
ImportError: dlopen(/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/uamqp/c_uamqp.cpython-310-darwin.so, 0x0002): symbol not found in flat namespace '_SASToken_CreateString'
PS-我已经为azure-eventhub做了pip安装。我在Mac M1机器上运行这个,用Python:第3.10.6节和第22.2.2节。
需要修复/导入哪些内容才能解决错误?
3条答案
按热度按时间krugob8w1#
尝试从源代码安装uamqp,而不是wheel/binary。
首先删除eventhub和uamqp库:
首先从源安装uamqp:
这对我的M1很有效,看看这对你是否也有效。
fjaof16o2#
在Python 3.10上,你可以更新到最新的uamqp包来获得Apple M1支持:
版本1.6.1及更高版本将支持Python 3.10及更高版本上的M1
li9yvcax3#
我想提供一个更新。我的团队刚刚发布了一个新版本的Event Hubs SDK,它使用了一个新的AMQP堆栈,全部用Python编写,并删除了对uamqp的依赖。这允许我们在多个平台上支持SDK,而无需进行任何突破性的更改。您可以
pip install azure-eventhub >= 5.11.0
获得最新版本。有关更多信息,请参见announcement和readme以了解与uamqp的向后兼容性