ModuleNotFoundError: No module named ‘captcha.fields’

  Kiến thức lập trình

By Executing command python manage.py runserver in vscode terminal occured this error :

Watching for file changes with StatReloader
Performing system checks...

Exception in thread django-main-thread:
Traceback (most recent call last):
  File "C:Users<user>AppDataLocalProgramsPythonPython312Libthreading.py", line 1073, in _bootstrap_inner
    self.run()
  File "C:Users<user>AppDataLocalProgramsPythonPython312Libthreading.py", line 1010, in run
    self._target(*self._args, **self._kwargs)
  File "C:Users<user>AppDataLocalProgramsPythonPython312Libsite-packagesdjangoutilsautoreload.py", line 64, in wrapper
    fn(*args, **kwargs)
  File "C:Users<user>AppDataLocalProgramsPythonPython312Libsite-packagesdjangocoremanagementcommandsrunserver.py", line 133, in inner_run
    self.check(display_num_errors=True)
  File "C:Users<user>AppDataLocalProgramsPythonPython312Libsite-packagesdjangocoremanagementbase.py", line 486, in check
    all_issues = checks.run_checks(
                 ^^^^^^^^^^^^^^^^^^
  ......
  File "<frozen importlib._bootstrap_external>", line 995, in exec_module
  File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
  File "D:<project path>porslineurls.py", line 10, in <module>   
    path('', include('survey.urls')),
             ^^^^^^^^^^^^^^^^^^^^^^
  File "C:Users<user>AppDataLocalProgramsPythonPython312Libsite-packagesdjangourlsconf.py", line 39, in include
    urlconf_module = import_module(urlconf_module)
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:Users<user>AppDataLocalProgramsPythonPython312Libimportlib__init__.py", line 90, in import_module     
    return _bootstrap._gcd_import(name[level:], package, level)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen importlib._bootstrap>", line 1387, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1360, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1331, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 935, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 995, in exec_module
  File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
  File "D:<project path>surveyurls.py", line 2, in <module>      
    from . import views
  File "D:<project path>surveyviews.py", line 14, in <module>    
    from . forms import CreateSurveyForm, CreateQuestionForm, ShowSurveyForm
  File "D:<project path>surveyforms.py", line 11, in <module>    
    from captcha.fields import CaptchaField
ModuleNotFoundError: No module named 'captcha.fields'

According to last line of top message ModuleNotFoundError: No module named 'captcha.fields', i executed commands pip3 install django-simple-captcha and pip3 install django-recaptcha but the problem not resolved.

There is a solution for this problem? please help me.

Notice : I saw No module named ‘captcha.fields’ but my problem not resolved!

LEAVE A COMMENT