简体   繁体   中英

Cannot import Azure Storage Blob package even though it is installed

I want to write a script to upload files to Azure Blob Storage. I installed the Azure Storage Blob package following this documentation and then tried to run from azure.storage.blob import BlobServiceClient I got the error:

No module named 'azure.storage'; 'azure' is not a package.

When I run pip show azure-storage-blob the package is in the expected place that is included in PATH.

The strange thing is that I can run import azure just fine but when I run pip show azure I get

WARNING: Package(s) not found: azure

This doesnt work either: from azure import BlobServiceClient .

I am using Anaconda / Windows and I tried this with Python 3.6, 3.7 and 3.8 with the same results.

Any help would be greatly appreciated. Thank you.

This issue was solved by Eric Truett's comment, add it as the answer to close the question:

  1. Try launching the anaconda prompt,

  2. then type ipython,

  3. then, in ipython, try from azure.storage.blob import BlobServiceClient .

  4. If you get an ImportError, then try !pip install azure-storage-blob and then try the import again.

I tried from azure.storage.blob import BlobServiceClient and got no error. So I went to Spyder and just ran the import there. It worked. I did not change anything else but it is working now.

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