Skip to content
Home » EnvironmentError: mysql_config not foundv

EnvironmentError: mysql_config not foundv

To solve pip install mysql-python fails with EnvironmentError: mysql_config not foundv error follow below methods.

ERROR LOG

    raise EnvironmentError("%s not found" % (mysql_config.path,))
    EnvironmentError: mysql_config not found
    Complete output from command python setup.py egg_info:
    sh: mysql_config: not found

How to solve pip install mysql-python fails with EnvironmentError: mysql_config not foundv ?

Refer the given methods to solve the issue.

Method 1:

Mysql config appears to be missing from your system, or the installer was unable to locate it. Check that mysql config is truly installed.

On Debian/Ubuntu, for example, you must install the package:

sudo apt-get install libmysqlclient-dev

Perhaps mysql config is not in your path; this will be the case if you compile the mysql suite yourself.

It is now available for latest versions of Debian/Ubuntu (as of 2018).

sudo apt install default-libmysqlclient-dev

Method 2 :

In Mac OS, I simply ran this in terminal to fix:

export PATH=$PATH:/usr/local/mysql/bin

This is the quickest solution I found – it adds it to the path, but I think you’d be better off adding it permanently (ie, to /etc/paths) if you plan to install MySQL-python in a different context.

Hope the above solution works.

Also read :

Route resource not working in Laravel 8.x
TypeError: ‘builtin_function_or_method’ object is not subscriptable