简体   繁体   中英

ImportError: No module named azure.storage.blob

I am trying to download a file from Azure onto my local device via python using the following code:

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')

However, when I run this code I get the following error:

ImportError: No module named azure.storage.blob

I already have installed the azure modules as seen by the snipping of the output of pip list:

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

I have tried following various posts about this issue like the following, but I have had no luck:

ImportError: No module named azure.storage.blob (when doing syncdb)

https://github.com/Azure/azure-storage-python/issues/262

Any advice?

Just for summary, your issue is resulted from the conflict between python 2.7 version you installed and the python version with Anaconda.

The packages you installed should to be in the python 2.7 environment. However, spyder uses the Anaconda self-brought python environment.

Command line uses system python environment which is determined by the the previous python environment variable in the path .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM