热线电话:13121318867

登录
2019-02-13 阅读量: 758
python 在python 导包报错如下

python 在python 导包报错如下

import PIL
Traceback (most recent call last):
File "<input>", line 1, in <module>
File "/Applications/PyCharm.app/Contents/helpers/pydev/_pydev_bundle/pydev_import_hook.py", line 19, in do_import
module = self._system_import(name, *args, **kwargs)
ImportError: No module named PIL

在shell 里面没有报错

Python 3.6.5 (default, Apr 25 2018, 14:26:36)
[GCC 4.2.1 Compatible Apple LLVM 9.0.0 (clang-900.0.39.2)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import PIL
>>>

这是为什么?

答:

查看一下运行的python环境和shell的运行环境是否一致,控制台的python3和实际运行目录下启动的python3不是同一个,然后导致导入的包漏导入。你可以在两个环境下,用

pip3 list

语句看看PIL是否存在,对比一下

0.0000
3
关注作者
收藏
评论(0)

发表评论

暂无数据
推荐帖子