2017-02-21 180 views
1

当我尝试导入Image模块时,无法找到模块。即使安装了模块,Python模块仍未找到错误

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 
>>> 

点数列表显示它已安装。

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) 

我使用的是Mac的默认python版本。

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. 
>>> 

PYTHONPATH变量似乎是空的,但是当我尝试导入其他已安装的软件包不显示“没有找到模块”错误。

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

我也试过一切说here,但它不适合我。

更新

所建议的模块是大小写敏感的,我尝试以下,但它也不能工作。

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 

回答

1

你需要做的,而不是import imageimport Image

模块名称是区分大小写的

+0

不,仍然无法正常工作。 Python 2.7.6(默认,2014年9月9日,15:04:36) [GCC 4.2.1兼容的Apple LLVM 6.0(clang-600.0.39) ] on darwin 输入“help”,“copyright”,“credits”或“license”以获取更多信息。 >>>导入图像 回溯(最近通话最后一个): 文件 “”,1号线,在 导入错误:没有模块命名的图像 ' –