我得到了一个ImportError
from azure.storage.blob import BlobServiceClient然而,我意识到当我将依赖项安装为
pip install azure-storage-blob
pip install azure-storage但当我安装它们的时候
pip install azure-storage
pip install azure-storage-blob在这两种情况下,pip freeze都显示相同的库
azure-common==1.1.23
azure-core==1.0.0
azure-nspkg==3.0.2
azure-storage==0.36.0
azure-storage-blob==12.0.0
certifi==2019.9.11
cffi==1.13.2
chardet==3.0.4
cryptography==2.8
idna==2.8
isodate==0.6.0
msrest==0.6.10
oauthlib==3.1.0
pycparser==2.19
python-dateutil==2.8.1
requests==2.22.0
requests-oauthlib==1.3.0
six==1.13.0
urllib3==1.25.7第二种方法有效,但我担心它稍后会抛出一个错误。在Azure图书馆有什么问题吗?还是我在这里漏掉了什么?
发布于 2019-11-20 00:54:49
正如@GauravMantri所说,如果您想使用azure-storage-blob包,只需安装from azure.storage.blob import BlobServiceClient包,因为包azure-storage-blob与azure-storage不同,但是它们使用相同的名称空间作为前缀。
因此,不同的安装顺序将得到不同的结果。例如,如下所示。
pip install azure-storage-blob
pip install azure-storage后端包azure-storage安装将涵盖示例命名空间azure.storage.blob,但不包括类BlobServiceClient,只包含类BlockBlobService of azure-storage。
作为参考,README.md of GitHub repo Azure/azure-storage-python/tree/master/azure-storage-blob还注意到,如下图所示,当您要使用azure-storage-blob时,必须首先卸载azure-storage<=0.36.0。

因此,如果您使用这些包的不一致安装顺序作为我的示例,您必须先卸载azure-storage,然后再安装azure-storage-blob,以避免以后可能出现的错误。
发布于 2019-11-20 00:45:07
请卸载azure-storage-blob和azure-storage。
然后使用以下命令:
pip install azure-storage-blob==12.0.0BlobServiceClient在最新版本12.0.0的天蓝色-存储-blob中
发布于 2019-11-20 01:28:05
不推荐使用包装天蓝色储藏室。
请使用这些包
https://pypi.org/project/azure-storage-blob/
https://pypi.org/project/azure-storage-queue/
https://pypi.org/project/azure-storage-file-share/
pip install azure-storage-blob就足够了,不需要安装azure-storage。
同样,如果您正在处理队列和文件,请安装它们。如果你还面临这个问题,请告诉我(我为azure团队工作)
https://stackoverflow.com/questions/58943229
复制相似问题