问题
I recently cloned a Django project of mine in a brand new machine, and went about setting up its dependencies. One such dependency was azure storages, for which I followed the advice here and simply did sudo pip install azure
.
However, upon `python manage.py syncdb', I keep getting the error:
ImportError: No module named azure.storage.blob
I've tried to solely do sudo pip install azure-storage
as well, but this doesn't alleviate my problem either. This shouldn't have been this problematic. What do I do?
回答1:
As I know, this issue is due to the version of azure storage client library for python.The old version has only one blobservice.py file and the newest splits it into three files such as blockblobservice.py, pageblobservice.py and appendblobservice.py. So, if you want to use BlockBlobService, you could install azure-storage 0.33.0.
The following steps help you to install azure-storage 0.33.0.
1.You could check the version using pip:
#pip freeze
2.If you see azure==0.11.0 (or any version below 1.0), uninstall it first:
#pip uninstall azure
3.Install azure-storage 0.33.0
#pip install --upgrade azure-storage
You may encounter some error about cryptography, you could run the following command to solve it.
#yum install gcc libffi-devel python-devel openssl-devel
#pip install cryptography
The references:
https://pypi.python.org/pypi/azure-storage
Failed to install Python Cryptography package with PIP and setup.py
Hope it helps. Any concerns, please feel free to let me know.
回答2:
Ubuntu 16.04TLS + Python 3.5 Nothing worked for me, however after some fiddling...
sudo pip3 uninstall -y $(pip3 freeze | grep azure)
sudo rm /home/YOUR_ACCOUNT/.local/python3.5/site-packages/azu* -r
sudo pip3 install --upgrade requests
sudo pip3 install azure-storage-blob
来源:https://stackoverflow.com/questions/39383741/importerror-no-module-named-azure-storage-blob-when-doing-syncdb