Reason for error:
The MySQLdb package has been deprecated in python3.
The solution
install pymysql package
pip install PyMySQL
To take the following directory structure as an example, add the following code to test5/test5/init.py:
import pymysql
pymysql.install_as_MySQLdb()
∎── booktest
∎ ∎── admin.py
∎ ∎── apps.py
∎ ── init.py
∎ ∎── migrations
∎ ∎ ∎── init.py
∎ ∎ └── pycache
∎ ∎── models.py
∎ ∎── pycache
∎ ∎── tests.py
∎ ∎── urls.py
∎ └── views.py
°── manage.py
°── static
∎ └── booktest
∎ └── a1.jpg -> /usr/share/wallpapers/deepin/Flying_Whale_by_Shu_Le.jpg
── templates
∎ └── index.html
└── test5
── init.py
── pycache
── settings.py
──urls.py
└── wsgi.py
Read More:
- [Solved] Django Error: django.core.exceptions.ImproperlyConfigured: Error loading MySQLdb module.
- [Solved] django.core.exceptions.ImproperlyConfigured: Error loading MySQLdb module.Did you install mysqlclie
- Module notfounderror when installing suds: no module named ‘client’ solution
- Module not found error: no module named ‘filefolder’ appears when learning engineering knowledge
- [Solved] Pychar error: modulenotfounderror: no module named ‘requests_ HTML ‘solution
- [Solved] ModuleNotFoundError: No module named ‘requests‘
- [How to Solve] ImportError: No module named typing
- [Solved] Pytest Error: E ModuleNotFoundError: No module named ‘common
- ModuleNotFoundError: No module named ‘requests‘ [How to Solve]
- Python: Django exception when executing migrate operation: django.db.utils.OperationalError: (1051, “Unknown table’xxx’”)
- How to Solve PyInstaller Package Error: ModuleNotFoundError: No module named ‘xxxx‘
- No module named ‘google.rpc‘ [How to Solve]
- [Solved] ByteTrack Error: ModuleNotFoundError: No module named ‘yolox’
- [Solved] ModuleNotFoundError: No module named ‘_polyiou‘
- [Solved] ModuleNotFoundError: No module named ‘xxx’; ‘xxx’ is not a package
- ModuleNotFoundError: no module named ‘pip‘ [How to Solve]
- [Solved] modulenotfounderror: no module named ‘torchtext.legacy.data.datasets_ utils‘
- [Solved] ModuleNotFoundError: No module named ‘pip‘
- [Mac M1] How to Solve import wordcloud Error: ModuleNotFoundError: No module named ‘wordcloud‘
- bandersnatch Error: No module Named [How to Solve]