1

When I try to import the Image module, it fails to find the module.

nn-MacBook-Pro-3:~ nn$ python
Python 2.7.6 (default, Sep  9 2014, 15:04:36) 
[GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.39)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import Image
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named Image
>>> 

Pip list shows that it is installed.

nn-MacBook-Pro-3:~ nn$ pip list
DEPRECATION: The default format will switch to columns in the future. You can use --format=(legacy|columns) (or define a format=(legacy|columns) in your pip.conf under the [list] section) to disable this warning.
appnope (0.1.0)
bleach (1.5.0)
cycler (0.9.0)
dask (0.13.0)
decorator (4.0.11)
distribute (0.7.3)
Django (1.10.5)
email (6.0.0a1)
entrypoints (0.2.2)
Flask (0.10.1)
html5lib (0.9999999)
image (1.5.5)

I'm using Mac's default python version.

nn-MacBook-Pro-3:~ nn$ python
Python 2.7.6 (default, Sep  9 2014, 15:04:36) 
[GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.39)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> 

The PYTHONPATH variable seems to be empty, but when I try to import other already installed packages it does not show the "no module found" error.

nn-MacBook-Pro-3:~ nn$ echo $PYTHONPATH

I have also tried everything stated here, but it didn't work for me.

Update

As Suggested that modules are case sensitive, I tried the following, it but didn't work either.

nn-MacBook-Pro-3:~ nn$ python
Python 2.7.6 (default, Sep  9 2014, 15:04:36) 
[GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.39)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import image
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named image
Community
  • 1
  • 1
Nick_inaw
  • 145
  • 3
  • 13

1 Answers1

1

you need to do import image instead of import Image

module names are case-sensitive

Mithilesh Gupta
  • 2,800
  • 1
  • 17
  • 17
  • Nope, still doesn't work. `nn-MacBook-Pro-3:~ nn$ python Python 2.7.6 (default, Sep 9 2014, 15:04:36) [GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.39)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> import image Traceback (most recent call last): File "", line 1, in ImportError: No module named image ` – Nick_inaw Feb 21 '17 at 06:13