Last modified: Jun 21, 2025 By Alexander Williams

How to Uninstall Django in Python

Django is a popular Python web framework. Sometimes, you may need to uninstall it. This guide will help you remove Django cleanly.

Why Uninstall Django?

You might need to uninstall Django for several reasons. Maybe you're switching to another framework or troubleshooting issues.

Other times, you may want to install a different Django version. Proper uninstallation ensures a clean environment.

Check Django Installation

First, verify if Django is installed. Run this command in your terminal:

 
python -m django --version

If Django is installed, this will show the version number. If not, you'll see an error.

Uninstall Django Using Pip

The easiest way to uninstall Django is with pip. Run this command:


pip uninstall django

Confirm the uninstallation when prompted. This removes the Django package.

Verify Django Removal

After uninstalling, check if Django is still present:

 
python -m django --version

You should see an error like "No module named django". This confirms successful removal.

Remove Django Dependencies

Django may have dependencies. To remove them, use:


pip freeze | grep -i django | xargs pip uninstall -y

This finds all Django-related packages and uninstalls them.

Clean Up Manual Installations

If you installed Django manually, delete these directories:


rm -rf ~/.local/lib/python*/site-packages/django*
rm -rf ~/.local/bin/django-admin

This removes any remaining Django files.

Uninstall Django from Virtual Environment

If Django is in a virtual environment, activate it first:


source venv/bin/activate  # Linux/Mac
venv\Scripts\activate    # Windows

Then run the uninstall command as before.

Troubleshooting

If you get permission errors, try:


sudo pip uninstall django

For more complex issues, check out our guide on how to uninstall TensorFlow.

Reinstall Django

After uninstalling, you can reinstall Django if needed:


pip install django

For specific versions, add the version number.

Alternative Methods

If pip doesn't work, you can manually delete Django from site-packages. Learn more in our Keras uninstall guide.

Conclusion

Uninstalling Django is simple with pip. Always verify removal and clean up dependencies. For other packages, see our PyTorch uninstall guide.

Remember, a clean Python environment helps avoid conflicts. Happy coding!