wogsland
wogsland

Reputation: 9518

Trouble installing mysqlclient via pip

I'm working on a Django (1.9.2) project where I need to connect to a MySQl database, and I'm trying to use the recommended mysqlclient library. However, when I attempt installation via pip install mysqlclient I get the following error:

Complete output from command python setup.py egg_info:
sh: mysql_config: command not found
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/private/var/folders/v9/vxdt4wms0_qgm9n10rt74p8m0000gn/T/pip-build-Xh__3p/mysqlclient/setup.py", line 17, in <module>
    metadata, options = get_config()
  File "setup_posix.py", line 44, in get_config
    libs = mysql_config("libs_r")
  File "setup_posix.py", line 26, in mysql_config
    raise EnvironmentError("%s not found" % (mysql_config.path,))
EnvironmentError: mysql_config not found

Where do I need to create this missing mysql_config?

Upvotes: 2

Views: 2244

Answers (1)

McGrady
McGrady

Reputation: 11487

For mac:

  • brew install mysql
  • export PATH=$PATH:/usr/local/mysql/bin
  • pip install mysqlclient

It works for me.

➜ which mysql_config    
/usr/local/bin/mysql_config

For ubuntu:

apt-get install libmysqlclient-dev (or libmariadbclient-dev)

Hope this helps.

Upvotes: 6

Related Questions