2017-02-21 178 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號線,在 導入錯誤:沒有模塊命名的圖像 ' –