Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error loading MySQLdb Module 'Did you install mysqlclient or MySQL-python?'

I am using windows 10 command line for a django project using python34 however, I am facing difficulties with SQL.

I have already installed mysqlclient using pip install mysqlclient==1.3.5 and located the file to make sure I was not delusional. I then ran python manage.py migrate to migrate the tables to the SQL database (I am using phpmyadmin). However when the command returned with...

 File "C:\Users\user\env\lib\site-packages\django\db\backends\mysql\base.py", line 30, in <module>     'Did you install mysqlclient or MySQL-python?' % e django.core.exceptions.ImproperlyConfigured: Error loading MySQLdb module: No module named 'MySQLdb'. Did you install mysqlclient or MySQL-python? 

I am aware that questions like these already exist, but not one solution seems to have made any impact on attempts. Thank you in advance.

like image 375
PrimeBenefiter Avatar asked Oct 24 '17 04:10

PrimeBenefiter


People also ask

What is MySQLdb module in python?

MySQLdb is an interface for connecting to a MySQL database server from Python. It implements the Python Database API v2. 0 and is built on top of the MySQL C API.


1 Answers

pip install pymysql 

Then, edit the __init__.py file in your project origin dir(the same as settings.py)

add:

import pymysql  pymysql.install_as_MySQLdb() 
like image 193
aforwardz Avatar answered Sep 22 '22 17:09

aforwardz