导入 azure.storage 错误

Import azure.storage error

我有这个环境:

pip3 freeze | grep -i azure
azure==1.0.3
azure-batch==1.1.0
azure-common==1.1.4
azure-mgmt==0.20.2
azure-mgmt-common==0.20.0
azure-mgmt-compute==0.20.1
azure-mgmt-network==0.20.1
azure-mgmt-nspkg==1.0.0
azure-mgmt-resource==0.20.1
azure-mgmt-storage==0.20.0
azure-nspkg==1.0.0
azure-servicebus==0.20.1
azure-servicemanagement-legacy==0.20.2
azure-storage==0.33.0
msrestazure==0.4.4

我尝试在 python 中执行这样一个程序:

from azure.storage.blob import BlockBlobService,ContentSettings

block_blob_service = BlockBlobService("xxx","***")

和python输出这个错误:

Traceback (most recent call last):
  File "azure.py", line 1, in <module>
    from azure.storage.blob import BlockBlobService,ContentSettings
  File "/Users/dgonzalez/Proyectos/iloveplatos/git/back/app/azure.py", line 1, in <module>
    from azure.storage.blob import BlockBlobService,ContentSettings
ImportError: No module named 'azure.storage'; 'azure' is not a package

任何想法,我已经用其他版本测试过,但我有同样的问题。我现在被屏蔽了。

谢谢!!

您自己制作的 azure.py 模块似乎干扰了系统 azure 模块。为您的模块命名。

问题出在您的 script/module 的名字 azure.py 上。 Python 将其导入为层次结构中的第一个。您应该将其重命名为其他名称,比如 azure_deployment.py 以避免与 Microsoft azure 包的名称冲突。