Django Error: "mysqlclient 1.3.13 or newer is required; you have 0.9.3"
Question:
When executing the "python manage.py inspectdb" command, an error occurs indicating that mysqlclient version 1.3.13 or newer is required. The installed version is 0.9.3, and all suggested fixes have been attempted without success.
Answer:
This issue is likely due to the project using pymysql instead of mysqlclient. To resolve it:
Locate the following code snippet in the project:
import pymysql pymysql.install_as_MySQLdb()
Insert a line of code between these two to simulate mysqlclient version 1.3.13:
import pymysql pymysql.version_info = (1, 3, 13, "final", 0) pymysql.install_as_MySQLdb()
Why pymysql is used instead of mysqlclient:
PyMySQL is preferred for projects due to its ease of installation as it does not depend on system libraries. However, mysqlclient offers better performance for projects with high performance requirements.
Installing mysqlclient:
If you need mysqlclient, ensure 'libssl-dev' is installed before running:
pip install mysqlclient
The above is the detailed content of How to Fix \'mysqlclient 1.3.13 or newer is required; you have 0.9.3\' Error in Django?. For more information, please follow other related articles on the PHP Chinese website!