ModuleNotFoundError: No module named 'PIL'问题

 

 

 

 

 

 

 

Traceback (most recent call last):
  File "D:\python_learn\meiduo_project\env\lib\site-packages\django\utils\autoreload.py", line 228, in wrapper
    fn(*args, **kwargs)
  File "D:\python_learn\meiduo_project\env\lib\site-packages\django\core\management\commands\runserver.py", line 124, in inner_run
    self.check(display_num_errors=True)
  File "D:\python_learn\meiduo_project\env\lib\site-packages\django\core\management\base.py", line 356, in check
    all_issues = self._run_checks(
  File "D:\python_learn\meiduo_project\env\lib\site-packages\django\core\management\base.py", line 346, in _run_checks
    return checks.run_checks(**kwargs)
  File "D:\python_learn\meiduo_project\env\lib\site-packages\django\core\checks\registry.py", line 81, in run_checks
    new_errors = check(app_configs=app_configs)
  File "D:\python_learn\meiduo_project\env\lib\site-packages\django\core\checks\urls.py", line 16, in check_url_config
    return check_resolver(resolver)
  File "D:\python_learn\meiduo_project\env\lib\site-packages\django\core\checks\urls.py", line 26, in check_resolver
    return check_method()
  File "D:\python_learn\meiduo_project\env\lib\site-packages\django\urls\resolvers.py", line 254, in check
    for pattern in self.url_patterns:
  File "D:\python_learn\meiduo_project\env\lib\site-packages\django\utils\functional.py", line 35, in __get__
    res = instance.__dict__[self.name] = self.func(instance)
  File "D:\python_learn\meiduo_project\env\lib\site-packages\django\urls\resolvers.py", line 405, in url_patterns
    patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
  File "D:\python_learn\meiduo_project\env\lib\site-packages\django\utils\functional.py", line 35, in __get__
    res = instance.__dict__[self.name] = self.func(instance)
  File "D:\python_learn\meiduo_project\env\lib\site-packages\django\urls\resolvers.py", line 398, in urlconf_module
    return import_module(self.urlconf_name)
  File "D:\Python\Python38\lib\importlib\__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 783, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "D:\python_learn\meiduo_project\meiduo_mall\meiduo_mall\urls.py", line 23, in <module>
    url(r'^', include('verification.urls')),
  File "D:\python_learn\meiduo_project\env\lib\site-packages\django\conf\urls\__init__.py", line 50, in include
    urlconf_module = import_module(urlconf_module)
  File "D:\Python\Python38\lib\importlib\__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 783, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "D:\python_learn\meiduo_project\meiduo_mall\meiduo_mall\apps\verification\urls.py", line 5, in <module>
    from . import views
  File "D:\python_learn\meiduo_project\meiduo_mall\meiduo_mall\apps\verification\views.py", line 9, in <module>
    from verification.libs.captcha.captcha import captcha
  File "D:\python_learn\meiduo_project\meiduo_mall\meiduo_mall\apps\verification\libs\captcha\captcha.py", line 11, in <module>
    from PIL import Image
ModuleNotFoundError: No module named 'PIL'
Exception ignored in thread started by: <_pydev_bundle.pydev_monkey._NewThreadStartupWithTrace object at 0x0000000005D92DF0>
Traceback (most recent call last):
  File "C:\Program Files\JetBrains\PyCharm 2020.1.1\plugins\python\helpers\pydev\_pydev_bundle\pydev_monkey.py", line 770, in __call__
    ret = self.original_func(*self.args, **self.kwargs)
  File "D:\python_learn\meiduo_project\env\lib\site-packages\django\utils\autoreload.py", line 228, in wrapper
    fn(*args, **kwargs)
  File "D:\python_learn\meiduo_project\env\lib\site-packages\django\core\management\commands\runserver.py", line 124, in inner_run
    self.check(display_num_errors=True)
  File "D:\python_learn\meiduo_project\env\lib\site-packages\django\core\management\base.py", line 356, in check
    all_issues = self._run_checks(
  File "D:\python_learn\meiduo_project\env\lib\site-packages\django\core\management\base.py", line 346, in _run_checks
    return checks.run_checks(**kwargs)
  File "D:\python_learn\meiduo_project\env\lib\site-packages\django\core\checks\registry.py", line 81, in run_checks
    new_errors = check(app_configs=app_configs)
  File "D:\python_learn\meiduo_project\env\lib\site-packages\django\core\checks\urls.py", line 16, in check_url_config
    return check_resolver(resolver)
  File "D:\python_learn\meiduo_project\env\lib\site-packages\django\core\checks\urls.py", line 26, in check_resolver
    return check_method()
  File "D:\python_learn\meiduo_project\env\lib\site-packages\django\urls\resolvers.py", line 254, in check
    for pattern in self.url_patterns:
  File "D:\python_learn\meiduo_project\env\lib\site-packages\django\utils\functional.py", line 35, in __get__
    res = instance.__dict__[self.name] = self.func(instance)
  File "D:\python_learn\meiduo_project\env\lib\site-packages\django\urls\resolvers.py", line 405, in url_patterns
    patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
  File "D:\python_learn\meiduo_project\env\lib\site-packages\django\utils\functional.py", line 35, in __get__
    res = instance.__dict__[self.name] = self.func(instance)
  File "D:\python_learn\meiduo_project\env\lib\site-packages\django\urls\resolvers.py", line 398, in urlconf_module
    return import_module(self.urlconf_name)
  File "D:\Python\Python38\lib\importlib\__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 783, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "D:\python_learn\meiduo_project\meiduo_mall\meiduo_mall\urls.py", line 23, in <module>
    url(r'^', include('verification.urls')),
  File "D:\python_learn\meiduo_project\env\lib\site-packages\django\conf\urls\__init__.py", line 50, in include
    urlconf_module = import_module(urlconf_module)
  File "D:\Python\Python38\lib\importlib\__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 783, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "D:\python_learn\meiduo_project\meiduo_mall\meiduo_mall\apps\verification\urls.py", line 5, in <module>
    from . import views
  File "D:\python_learn\meiduo_project\meiduo_mall\meiduo_mall\apps\verification\views.py", line 9, in <module>
    from verification.libs.captcha.captcha import captcha
  File "D:\python_learn\meiduo_project\meiduo_mall\meiduo_mall\apps\verification\libs\captcha\captcha.py", line 11, in <module>
    from PIL import Image
ModuleNotFoundError: No module named 'PIL'

Process finished with exit code -1

 

 

运行安装pillow命令:

pip install pillow

 

如果运行时显示

表示已经安装过了,这时可以先卸载,获取最新的pillow
运行卸载命令:

 pip uninstall pillow

 

 

 

 然后再次运行安装命令

pip install pillow

 

 安装成功报错解决

posted @ 2020-08-06 16:45  sewen  Views(939)  Comments(0Edit  收藏  举报