7
I just installed my virtual environment, installed Pymysql and created a project, however, when trying to start an APP python manage.py startapp nome
, the following problem arose:
Error loading MySQLdb module: No module named 'MySQLdb'
How can I set up Mysql and fix it?
Man settings.py
:
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'NAME': 'meudb',
'USER': 'root',
'PASSWORD': '123',
'HOST': 'localhost',
}
}
The error persists.
– Renzo Rodrigues
I just created a test environment with Python 3.4.3, Django and mysqlclient and everything worked perfectly. I removed the mysqlclient module and got the same error as you. So, you are sure you can install mysqlclient?
– ppalacios
I also did the test: I changed the Python version to 3.4, created a new virtual environment, installed Django1.8, then mysqlclient. I created a new project (Django-admin startproject name) and finally made the change in the file Settings.py. While trying to create a new App gave again the error message.
– Renzo Rodrigues
What is your operating system? Are Mysql development libraries installed? If you open the interpreter of your virtual environment and type import Mysqldb, what happens?
– ppalacios
>>> import mysqldb Traceback (Most recent call last): File "<stdin>", line 1, in <module> Import: No module named 'mysqldb'
– Renzo Rodrigues
so: linux Mint 17
– Renzo Rodrigues
important that you type respecting the upper and lower case letters.
– ppalacios
Import: No module named 'Mysqldb'
– Renzo Rodrigues
If I change the python version to python2.7, mysql works normally. Only in version 3.4 does it present the problem. I already installed python-Mysqldb
– Renzo Rodrigues
You have enabled the virtual environment before installing?
– ppalacios