[Fixed]-Error Loading MySQLdb Module and "pip install MySQLdb"

29👍

Clearly installing pip install MySQL-python is the way to go. The problem is with the location of mysql_config. Look around here, this might help you depending on your OS: mysql_config not found when installing mysqldb python interface

Edit:

In case the install script fails with Command "python setup.py egg_info" failed with error code 1 in {...}, installing libmysqlclient-dev with

sudo apt install libmysqlclient-dev

should fix the issue. Thanks to @thirupathi-thangavel.

👤fodma1

3👍

If the above method not working then try

mysqlclient

pip install mysqlclient

I did not found the above library using python version(3.9) and I installed the mysqlclient and it worked for fine.

1👍

brew install mysql

Path will be shown after installation is complete, use that in below command :

sudo PATH=/usr/local/Cellar/mysql/bin/:$PATH pip install mysql-python

0👍

I followed my question here 404 error when using brew to install mysql

and then as fodma1 suggested went to here stackoverflow.com/a/33928783/2419215

and now it works for the most part (have another error but thats for another post)!

Thanks EdBaker and fodma1!

👤Bren

Leave a comment