python - ImportError:没有名为 azure.storage.blob 的模块
问题描述
我正在尝试使用以下代码通过 python 将 Azure 中的文件下载到我的本地设备上:
from azure.storage.blob import BlockBlobService
block_blob_service = BlockBlobService(account_name='account_name',
account_key='mykey')
block_blob_service.get_blob_to_path('container', 'file', 'out-test.csv')
但是,当我运行此代码时,出现以下错误:
ImportError: No module named azure.storage.blob
从 pip list 的输出截图可以看出,我已经安装了 azure 模块:
C:\Users\hpfc87>pip list
Package Version
-------------------- ---------
adal 0.6.0
asn1crypto 0.24.0
azure-common 1.1.11
azure-nspkg 2.0.0
azure-storage 0.36.0
azure-storage-blob 1.1.0
azure-storage-common 1.1.0
azure-storage-file 1.1.0
azure-storage-nspkg 3.0.0
azure-storage-queue 1.1.0
我曾尝试关注以下有关此问题的各种帖子,但我没有运气:
ImportError:没有名为 azure.storage.blob 的模块(执行 syncdb 时)
https://github.com/Azure/azure-storage-python/issues/262
有什么建议吗?
解决方案
总结一下,您的问题是由于您安装的 python 2.7 版本与带有 Anaconda 的 python 版本之间的冲突造成的。
您安装的软件包应该在 python 2.7 环境中。不过spyder使用的是Anaconda自带的python环境。
命令行使用系统 python 环境,该环境由path
.
推荐阅读
- javascript - .replace(/'/g, '"'); 用双引号替换单引号在nodejs中不起作用
- rest - 我应该使用一个 HTTP 请求来检查某项操作是否可行,然后使用另一个请求来执行该操作,还是应该将其捆绑到一个请求中?
- r - 在R中使用ggplot覆盖两个不同尺寸的图
- html - 行显示块的中心内容 Bootstrap v4
- arrays - JSON验证期望'}',',',']',得到'{'
- html - 内联标签后的XPath到文本?
- r - gganimate 注释一个不在 transition_states 中的日期变量
- google-sheets - 如何在 Google 表格中提取两个单词之间的文本?
- python - 是否有与 Julia 的 LaTeXStrings 类似的 Python?
- python - pandas .drop 条件问题