I did this:
sudo pip install azure azure-storage azure-servicebus azure-mgmt azure-servicemanagement-legacy
from azure import *
Traceback (most recent call last): File "", line 1, in ImportError: No module named azure
from azure.storage import BlobService
Traceback (most recent call last): File "", line 1, in ImportError: No module named azure.storage
Python package installed thru cmd sudo pip install
exists at the paths /usr/lib/python2.7
, /usr/local/python2.7
, etc and their sub-folder dist-packages
.
You can code import sys
and print sys.path
in the Python Interpreter to show the completed path list for current python environment.
Iif you installed successfully some packages like azure
& azure-storage
, you can find these files relate to the package in the python library paths.
However, you got the error in Import Error: No module named <package-name>
when you run the code import <package-name>
or from <package-name> import <class or object name>
. There are two scenes that would be cause the issue normally.
sys.path
in python or PYTHONHOME
in environment variables.So I think you can try to solve the issue thru three ways below.
sys.path
thru the method sys.path.append('<package path>')
in python code.PYTHONHOME
whether or not set up. If set up PYTHONHOME
, python will add package path based on PYTHONHOME
into sys.path
.sudo apt-get remove python python-pip
, sudo apt-get update
, sudo apt-get install python python-pip
on Ubuntu. It's a simple way.BlobService belongs to azure.storage.blob rather than the azure.storage
it should rather be
from azure.storage.blob import BlobService
Link - https://azure.microsoft.com/en-us/documentation/articles/storage-python-how-to-use-blob-storage/
If it still doesn't work for you, you might would like to use virtualEnv and do the pip install again while in virtualenv
http://docs.python-guide.org/en/latest/dev/virtualenvs/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With