gpt4 book ai didi

python - 从 'BlobServiceClient' 导入 'azure.storage.blob' 时出错

转载 作者:行者123 更新时间:2023-12-04 11:18:02 28 4
gpt4 key购买 nike

我有以下代码行:

from azure.storage.blob import BlobServiceClient

我收到以下错误:

from azure.storage.blob import BlobServiceClient
ImportError: cannot import name 'BlobServiceClient' from 'azure.storage.blob' (/home/user-name/.local/lib/python3.7/site-packages/azure/storage/blob/__init__.py)

我在 PythonAnywhere 和本地计算机上都出现此错误。我正在关注教程here

我已阅读this post在github上但无济于事。

缺少什么?我试图实现的目标是当我有 URI 和共享 key 时访问容器中的 blob。

感谢任何帮助。

最佳答案

您能否检查pip list并确保您拥有最新版本的azure-storage-blob,即 >= 12.0.0?

BlobServiceClient 是在 12.0.0 中引入的。

如果您有旧版本,请执行以下操作pip install azure-storage-blob --upgrade

此外,azure-storage-blob v 12.0.0 及更高版本已移至不同的存储库 https://github.com/Azure/azure-sdk-for-python/tree/master/sdk/storage/azure-storage-blob

编辑:azure-storage-blob >= 12.0 与 azure-storage 元包不兼容,以防安装最新主要版本的 azure-storage 后问题仍然存在-blob

关于python - 从 'BlobServiceClient' 导入 'azure.storage.blob' 时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58768443/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com