ImportError: No module named MySQLdb
If you're having issues compiling the binary extension, or on a platform where you cant, you can try using the pure python PyMySQL
bindings.
Simply pip install pymysql
and switch your SQLAlchemy URI to start like this:
SQLALCHEMY_DATABASE_URI = 'mysql+pymysql://.....'
There are some other drivers you could also try.
Error loading MySQLdb module: No module named 'MySQLdb'
MySQLdb is only for Python 2.x. You can't install in Python 3.x versions. Now from your question i can see that you are working with Django. In this case you have three alternatives, from Django mysql notes:
- mysqldb
- mysqlclient
- mysql-connect-python
This gives to you two alternatives, mysqlclient and mysql-connect-python, The first one requires compilation from extensions for the plugin and, in Windows, this implies VStudio Libraries and a know-how for compile native extensions.
mysql-connect-python is not compiled (and i don't recommend this for production, maybe only for dev) so you are going to need to install this.
You can try:
pip3 install mysql-connect-python
or
pip3 install http://cdn.mysql.com/Downloads/Connector-Python/mysql-connector-python-2.0.4.zip
if the first one fails.
Related Topics
Circular List Iterator in Python
Locale Date Formatting in Python
How to Keep Track of Class Instances
Permissionerror: [Errno 13] in Python
":=" Syntax and Assignment Expressions: What and Why
Type Hinting a Collection of a Specified Type
How to Make a Cross-Module Variable
Python and Regular Expression with Unicode
Weighted Random Selection with and Without Replacement
Priority of the Logical Operators Not, And, or in Python
Django Auto_Now and Auto_Now_Add
Why Do We Use _Init_ in Python Classes
What's a Good Rate Limiting Algorithm
Which Python Packages Offer a Stand-Alone Event System
How to Take Column-Slices of Dataframe in Pandas
Python Ctypes - Loading Dll Throws Oserror: [Winerror 193] %1 Is Not a Valid Win32 Application
Pygame Already Installed; However, Python Terminal Says "No Module Named 'Pygame' " (Ubuntu 20.04.1)