Python Importerror When Module Is In Sys.path
Solution 1:
A few things that commonly result in this error:
Module is not in PYTHONPATH. Since you have checked this with
sys.path
, I will assume that it is there already. However, for future reference, you can manually add it to yourprofile
orbashrc
file in the home directory.It may be that the module that you are using doesn't have a
__init__.py
file or the module path in PYTHONPATH doesn't point to the uppermost directory with__init__.py
. You can fix this by adding a blank__init__.py
file where necessary or editing the module path.Another possibility is that the python interpreter that you used
sys.path
is not the same python in which the module was installed. Commonly, this is due to two different versions of python installed on the same machine. Make sure that your module is installed for the correct python interpreter or switch into the correct (usually not default) python usingsource activate
.
Hope this helps!
Post a Comment for "Python Importerror When Module Is In Sys.path"