[Django]-Fresh python 3.7 / django 2.2.1 installation not recognising that mysqlclient is installed

6👍

SOLVED

So it looks like the issue was that on initial installation the mysqlclient library had compiled against the wrong version of mysql (not sure how that happened), so I had to force it to recompile.

Here are the steps:

brew uninstall mysql
brew uninstall myysql-connector-c
pipenv uninstall mysqlclient
brew install mysql-connector-c

At this point we need to update /usr/local/bin/mysql_config as per the instructions that conor linked to (thanks again conor), i.e. change the line that read

libs="$libs -l "

to

libs="$libs -lmysqlclient -lssl -lcrypto "

Then, to fix the resultant “library not found for -lssl” error I used the answer from this question:

export PATH="/usr/local/opt/openssl/bin:$PATH"
export LDFLAGS="-L/usr/local/opt/openssl/lib"
export CPPFLAGS="-I/usr/local/opt/openssl/include"

Then finally force mysqlclient to recompile and reinstall mysql:

pip install --force-reinstall --ignore-installed --no-binary :all: mysqlclient
brew unlink mysql-connector-c
brew install mysql

Thanks to everyone who took time to help out!

👤Jonah

3👍

If you’re on macos do this

$ brew uninstall mysql
$ brew install mysql-connector-c
$ brew unlink mysql-connector-c
$ brew install mysql
$ pip install mysql-python

and follow the instructions here: https://pypi.org/project/mysqlclient/

👤connor

1👍

Downgrading from python 3.7.4 to python 3.6 solved the issue for me on windows 10.

Leave a comment