0

I'm attempting to install mysqlclient using the command:

pip install mysqlclient but i get the following error:

Using cached mysqlclient-1.3.12.tar.gz
    Complete output from command python setup.py egg_info:
    /bin/sh: mysql_config: command not found
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/private/var/folders/8d/xdwdnphs1w5b_vtxrc67__5h0000gn/T/pip-build-ifu54299/mysqlclient/setup.py", line 17, in <module>
        metadata, options = get_config()
      File "/private/var/folders/8d/xdwdnphs1w5b_vtxrc67__5h0000gn/T/pip-build-ifu54299/mysqlclient/setup_posix.py", line 44, in get_config
        libs = mysql_config("libs_r")
      File "/private/var/folders/8d/xdwdnphs1w5b_vtxrc67__5h0000gn/T/pip-build-ifu54299/mysqlclient/setup_posix.py", line 26, in mysql_config
        raise EnvironmentError("%s not found" % (mysql_config.path,))
    OSError: mysql_config not found

I uninstalled python3 using brew uninstall --force python3 and downloaded the binary from pythons website but to no avail. I also attempted to download mysql connector from oracle website and again to no avail. I have tried upgrading pip again still doesnt work.

PS mysql is running in a docker container and i'm running django on my local machine.

Any suggestions on why i'm getting an error attempting to install mysqlclient

Vadim Kotov
  • 8,084
  • 8
  • 48
  • 62
EI-01
  • 1,075
  • 3
  • 24
  • 42

2 Answers2

0

For Python I can recommend pymysql is pretty good and I always use it. https://github.com/PyMySQL/PyMySQL

or you can follow this answer

Installing MySQL Python on Mac OS X

Zrufy
  • 423
  • 9
  • 22
  • what would be the mistake it gives you? If you can not connect to the database. Just add where the mysqli.sock file is located. For example: `conn = pymysql.connect(db='DB', user='USER', passwd='pass', unix_socket="/Applications/XAMPP/xamppfiles/var/mysql/mysql.sock",autocommit=True)` Let me know news. – Zrufy Oct 21 '17 at 15:13
0

you need to install mysql and mysql connector before install my sql client

brew install mysql

brew install mysql-connector-c