从Python连接到Azure存储所需的确切软件包是什么



我被一堆包的弃用警告弄糊涂了。我一直在卸载和重新安装一堆软件包,但都无济于事。我的脚本在以下行引发错误:from azure.storage.blob import BlobServiceClient, BlobClient, ContainerClient

由此产生的错误是:

Traceback (most recent call last):
File "C:Usersusernamedirtest.py", line 2, in <module>
from azure.storage.blob import BlobServiceClient, BlobClient, ContainerClient
ImportError: cannot import name 'BlobServiceClient'

Azure相关包的pip freeze输出为:

adal==1.2.2
azure-common==1.1.25
azure-core==1.4.0
azure-identity==1.3.1
azure-nspkg==3.0.2
azure-storage==0.36.0
azure-storage-common==2.1.0

我是不是错过了什么?我见过一些人使用azure-storage-common,也安装了它。

您想要安装的软件包是azure-storage-blob。该包有BlobServiceClientBlobClientContainerClient

您可以在此处获取更多信息:https://learn.microsoft.com/en-us/azure/storage/blobs/storage-quickstart-blobs-python以下是API参考文档的链接:https://learn.microsoft.com/en-us/python/api/azure-storage-blob/azure.storage.blob?view=azure-python。

最新更新