2019-02-13
閱讀量:
785
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環(huán)境和shell的運行環(huán)境是否一致,控制臺的python3和實際運行目錄下啟動的python3不是同一個,然后導致導入的包漏導入。你可以在兩個環(huán)境下,用
pip3 list
語句看看PIL是否存在,對比一下






評論(0)


暫無數(shù)據(jù)
推薦帖子
0條評論
0條評論
0條評論