Edgar Navasardyan Edgar Navasardyan - 17 days ago 9
MySQL Question

Installing MySQLDB for python 2.7 using pip on Windows 7 64bit

I have spent hours trying multiple approaches to install MYSQLDB module for python, and no success.

My python version: 2.7.6

Django - 1.10.3

OS: Windows 7 64-bit

MySQL connector - MySQL Connector C 6.0.2

Currently I have an error in my project, namely:

django.core.exceptions.ImproperlyConfigured: Error loading MySQLdb module: No module named MySQLdb


I have tried to install mysqldb running the following command:

pip install mysql-python


It ran successfully, but the error still persisted. Then I tried to run

pip install MySQL-python


and I am getting
Cannot open include file config-win.h
.
I came across this post, but I don't understand the idea of the answer, specifically, I can't figure out where I should look for the mentioned files
site.cfg
and
setup_windows.py
. There are no such files in
C:\Program Files\MySQL\MySQL Connector C 6.0.2\include


Finally, I tried to install MySQLDb using wheels running
pip install mysqlclient-1.3.9-cp27-cp27m-win_amd64.whl
command, I end up with

mysqlclient-1.3.9-cp27-cp27m-win_amd64.whl is not a supported wheel on this platform
error.

I have lost my hope. Help please !!!

Answer

Try to install 32 bit version mysqlclient-1.3.9-cp27-cp27m-win32.whl

If it doesn't work try to install it from (where you can find compiled windows libraries):

http://www.lfd.uci.edu/~gohlke/pythonlibs/