How to Solve Django Error: No module named ‘MySQLdb’

Since many related dependent packages were unloaded when MySQL was unloaded, the following error occurred when Django was started after reloading MySQL:

django.core.exceptions.ImproperlyConfigured:Error loading MySQLdb module: No module named 'MySQLdb".
Did you install mysqlclient or MySQL-python?

Due to the development of Python version 3.6.4, mysql-python does not support python3, after a lot of trouble to install mysqlclient

The following is my process to solve the problem, I am lazy, I will show you in the form of pictures

First of all, I tried to install MySQL python, but there was an error. The following is the solution for online search:

Here’s how I found the solution and installed mysqlclient:

The following is the code to install mysqlclient and its dependent environment:

pip install mysqlclient
sudo apt-get install python3-dev libmysqlclient-dev

Conclusion:

When there is a problem with no module named ‘MySQL db’. It is recommended to install mysqlclient. MySQL Python does not support python3

Similar Posts: