Pip Install Mysqlclient Error

Pip Install Mysqlclient Error

Environment: Ubuntu 18.04

Error 1. OSError: mysql_config not found

Solution 1

sudo apt-get install libmysqlclient-dev -y

Error 2. unable to execute ‘x86_64-linux-gnu-gcc’: No such file or directory

Solution 2


sudo apt-get install gcc -y

Error 3. MySQLdb/_mysql.c:46:10: fatal error: Python.h: No such file or directory

Solution 3

sudo apt-get install python3-dev -y

Final Code

sudo apt-get update
sudo apt-get install python3-venv -y
sudo apt-get install libmysqlclient-dev -y
sudo apt-get install gcc -y
sudo apt-get install python3-dev -y
python3 -m venv venv
. venv/bin/activate
pip install mysqlclient

Happy Coding!

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: