从 Python 连接到 Azure 存储所需的具体包是什么?

What are the exact packages required to connect to Azure Storage from Python?

我对一堆软件包的弃用警告感到困惑。我一直在卸载并重新安装一堆软件包无济于事。我的脚本在这一行抛出错误:from azure.storage.blob import BlobServiceClient, BlobClient, ContainerClient

结果错误是:

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

pip freeze 与 Azure 相关的包的输出是:

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://docs.microsoft.com/en-us/azure/storage/blobs/storage-quickstart-blobs-python and here's the link to the API reference documentation for the same: https://docs.microsoft.com/en-us/python/api/azure-storage-blob/azure.storage.blob?view=azure-python