The error /usr/bin/python: No module named django occurs when running a script using system Python rather than the virtual environment where Django is installed.

Virtual Environment Fix Commands

Terminal Fix Commandsbash
# 1. Create virtual environment
python3 -m venv venv
 
# 2. Activate virtual environment
source venv/bin/activate
 
# 3. Install Django inside active virtualenv
pip install django
 
# 4. Verify python path and django version
which python
python -m django --version