shaare.it

ModuleNotFoundError: No module named 'django'

7 Dec 2025

1 min read

ModuleNotFoundError: No module named ‘django’

$ python -c "import django"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
ModuleNotFoundError: No module named 'django'

Why this happens

Django isn’t installed in the current Python environment, or you’re using a different interpreter/virtualenv than expected.

Fix

Install Django into the active environment and verify you are using the correct interpreter.

Wrong code

import django
print(django.get_version())

Fixed code

# Ensure the environment has Django installed
# pip install django

import django
print(django.get_version())