[Django]-Error when installing mysqlclient

4👍

If you see the document of mysqlclient, I think it make mighty help for you.

The document say:

Note that this is a basic step. I can not support complete step for build for all environment. If you can see some error, you should fix it by yourself, or ask for support in some user forum. Don’t file a issue on the issue tracker.

You may need to install the Python 3 and MySQL development headers and libraries like so:

$ sudo apt-get install python3-dev default-libmysqlclient-dev build-essential # Debian / Ubuntu

$ sudo yum install python3-devel mysql-devel # Red Hat / CentOS

Then you can install mysqlclient via pip now:

$ pip install mysqlclient 

2👍

brew install mysql

fixed this for me

2👍

If you are on windows,

you can install mysqlclient using wheel from here.

Donwload the appropriate file as per your platform; for eg: if you are using python 3.6 and 32 bit python then download

mysqlclient‑1.3.13‑cp36‑cp36m‑win32.whl

After downloading it, copy it in C:/
Then install the file using following code:

pip3 install C:\mysqlclient‑1.3.13‑cp36‑cp36m‑win32.whl\

If you are using a virtual environment, then activate your virtual env before installing.

1👍

Please visit the following link which contains working pip installations for different os:

https://github.com/prasad01dalavi/python_packages_installations

for python2 in linux

sudo apt-get install -y python-dev libmysqlclient-dev && sudo pip install mysqlclient
👤Prasad

0👍

For Ubuntu, you may also have to install other dependencies:

apt-get update
apt-get install python3-dev default-libmysqlclient-dev build-essential pkg-config

Then try (from your virtual environment)

python3 -m pip install mysqlclient

Or as root (NOT Recommended):

pip install mysqlclient

That works for me.

Combining

Error when installing mysqlclient

and

Mysqlclient cannot install via pip, cannot find pkg-config name

Leave a comment