A user has encountered an error while setting up SQL for a Django project using Python 3.4 on Windows 10. Despite installing MySQLclient and locating the file, the command "python manage.py migrate" fails with the message:
Error loading MySQLdb module: No module named 'MySQLdb'. Did you install mysqlclient or MySQL-python?
To resolve this issue, the user can follow these steps:
Install the pymysql library:
pip install pymysql
Edit the __init__.py file in the project's origin directory (where settings.py is located):
Add the following lines:
import pymysql pymysql.install_as_MySQLdb()
This will install and configure pymysql to emulate the MySQLdb module, solving the error.
以上是\'載入 MySQLdb 模組時出錯:您安裝了 MySQLclient 或 MySQL-python 嗎?\” - 如何修復它的詳細內容。更多資訊請關注PHP中文網其他相關文章!