我收到一个 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库中是否存在问题,或者我在这里缺少什么?
答案 0 :(得分:0)
请卸载c_Equipment = {
1:
{
"Chain mail":"While wearing armour you have a disadvantage on Dexterity (Stealth) checks",
"Greataxe": 1,
"Javelins":3,
"Backpack": 1,
"Blanket": 1,
"Tinderbox": 1,
"Rations": 2,
"Waterskin": 1
},
和azure-storage-blob
。
然后使用此命令:
azure-storage
pip install azure-storage-blob==12.0.0
在latest version 12.0.0 of azure-storage-blob
答案 1 :(得分:0)
正如@GauravMantri所说,如果要使用from azure.storage.blob import BlobServiceClient
,则只需安装azure-storage-blob
软件包,因为软件包azure-storage-blob
与azure-storage
不同,但是它们使用相同的软件包命名空间作为前缀。
因此,不同的安装顺序将获得不同的结果。例如,如下。
pip install azure-storage-blob
pip install azure-storage
后部软件包azure-storage
的安装将覆盖示例名称空间azure.storage.blob
,但不包括类BlobServiceClient
,仅包括BlockBlobService
的类azure-storage
。
作为参考,GitHub存储库Azure/azure-storage-python/tree/master/azure-storage-blob
的README.md
也如下图所示,要使用azure-storage<=0.36.0
,必须首先卸载azure-storage-blob
。 / p>
因此,如果您以这些软件包的安装顺序为例,则必须先卸载azure-storage
并安装azure-storage-blob
再次避免潜在的错误。
答案 2 :(得分:0)
不推荐使用azure-storage软件包。
请使用这些软件包
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 sdk团队工作)