首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Python模块即使在安装模块时也找不到错误

Python模块即使在安装模块时也找不到错误
EN

Stack Overflow用户
提问于 2017-02-21 06:06:52
回答 1查看 1K关注 0票数 1

当我试图导入Image模块时,它无法找到该模块。

代码语言:javascript
复制
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列表显示它已安装。

代码语言:javascript
复制
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版本。

代码语言:javascript
复制
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变量似乎是空的,但是当我试图导入其他已安装的包时,它不会显示“没有模块找到”错误。

代码语言:javascript
复制
nn-MacBook-Pro-3:~ nn$ echo $PYTHONPATH

我也尝试过所有的方法,here说,但是它对我没有用。

更新

正如所建议的模块区分大小写一样,我尝试了以下方法,但也没有工作。

代码语言:javascript
复制
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
EN

回答 1

Stack Overflow用户

发布于 2017-02-21 06:09:40

你需要做import image而不是import Image

模块名区分大小写。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/42359865

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档