Django Python 3 Error in MySQL Module Installation


django.core.exceptions.ImproperlyConfigured: Error loading MySQLdb module. Did you install mysqlclient?

ModuleNotFoundError: No module named ‘ConfigParser’


I tried to install mysql module using pip command but it failed several times. pip install mysqlclient

Here are the steps worked for me. Run each command one by one in terminal. Note I used pip3 instead on pip because of I have python2 and python3 both installed on my MacBook. If you have only installed python3 on your pc then run only pip command. Python 2 is by default installed on MacBooks.

  1. pip3 install mysql-connector
  2. pip3 install PyMySQL
  3. pip3 install mysql-client
  4. export PATH=”/usr/local/opt/openssl/bin:$PATH”
    export LDFLAGS=”-L/usr/local/opt/openssl/lib”
    export CPPFLAGS=”-I/usr/local/opt/openssl/include”
  5. pip3 install mysqlclient

Written by Bala Krishna

Bala Krishna is web developer and occasional blogger from Bhopal, MP, India. He like to share idea, issue he face while working with the code.