pip install mysql-python fails with EnvironmentError: mysql_config not found

pip install mysqlclient mysql_config not found mac
_mysql.c:44:10: fatal error: 'my_config.h' file not found
modulenotfounderror: no module named 'configparser'
pip install mysql-python error mac
oserror: mysql_config not found centos
error: failed building wheel for mysql-python
fedora oserror mysql_config not found
pip install mysql_config

This is the error I get

(mysite)zjm1126@zjm1126-G41MT-S2:~/zjm_test/mysite$ pip install mysql-python
Downloading/unpacking mysql-python
  Downloading MySQL-python-1.2.3.tar.gz (70Kb): 70Kb downloaded
  Running setup.py egg_info for package mysql-python
    sh: mysql_config: not found
    Traceback (most recent call last):
      File "<string>", line 14, in <module>
      File "/home/zjm1126/zjm_test/mysite/build/mysql-python/setup.py", line 15, in <module>
        metadata, options = get_config()
      File "setup_posix.py", line 43, in get_config
        libs = mysql_config("libs_r")
      File "setup_posix.py", line 24, in mysql_config
        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

Traceback (most recent call last):

  File "<string>", line 14, in <module>

  File "/home/zjm1126/zjm_test/mysite/build/mysql-python/setup.py", line 15, in <module>

    metadata, options = get_config()

  File "setup_posix.py", line 43, in get_config

    libs = mysql_config("libs_r")

  File "setup_posix.py", line 24, in mysql_config

    raise EnvironmentError("%s not found" % (mysql_config.path,))

EnvironmentError: mysql_config not found

----------------------------------------
Command python setup.py egg_info failed with error code 1
Storing complete log in /home/zjm1126/.pip/pip.log
(mysite)zjm1126@zjm1126-G41MT-S2:~/zjm_test/mysite$ pip install mysql-python
Downloading/unpacking mysql-python
  Running setup.py egg_info for package mysql-python
    sh: mysql_config: not found
    Traceback (most recent call last):
      File "<string>", line 14, in <module>
      File "/home/zjm1126/zjm_test/mysite/build/mysql-python/setup.py", line 15, in <module>
        metadata, options = get_config()
      File "setup_posix.py", line 43, in get_config
        libs = mysql_config("libs_r")
      File "setup_posix.py", line 24, in mysql_config
        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

Traceback (most recent call last):

  File "<string>", line 14, in <module>

  File "/home/zjm1126/zjm_test/mysite/build/mysql-python/setup.py", line 15, in <module>

    metadata, options = get_config()

  File "setup_posix.py", line 43, in get_config

    libs = mysql_config("libs_r")

  File "setup_posix.py", line 24, in mysql_config

    raise EnvironmentError("%s not found" % (mysql_config.path,))

EnvironmentError: mysql_config not found

----------------------------------------
Command python setup.py egg_info failed with error code 1
Storing complete log in /home/zjm1126/.pip/pip.log

What can I do to resolve this?


It seems mysql_config is missing on your system or the installer could not find it. Be sure mysql_config is really installed.

For example on Debian/Ubuntu you must install the package:

sudo apt-get install libmysqlclient-dev

Maybe the mysql_config is not in your path, it will be the case when you compile by yourself the mysql suite.

Update: For recent versions of debian/ubuntu (as of 2018) it is

sudo apt install default-libmysqlclient-dev

Installing fails: mysql_config not found · Issue #275 · clips/pattern , sudo pip install pattern and get EnvironmentError: mysql_config not found. Try installing mysqlclient separately and then try the sudo pip install pattern Command "python setup.py egg_info" failed with error code 1 #279. Join the world's most active Tech Community! Welcome back to the World's most active Tech Community!


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

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

This is the quickest fix I found - it adds it to the path, but I think you're better off adding it permanently (ie add it to /etc/paths) if you plan to install MySQL-python in another environment.

(tested in OSX Mountain Lion)

EnvironmentError: mysql_config not found · Issue #1 , While installing the requirements, following error is thrown: File http://​stackoverflow.com/questions/5178292/pip-install-mysql-python-fails-with-​environmenterror-mysql-config-not-found solved the issue. Closing this. Maybe the mysql_config is not in your path, it will be the case when you compile by yourself the mysql suite. Update: For recent versions of debian/ubuntu (as of 2020) it is. sudo apt install default-libmysqlclient-dev. Hope this is helpful!! Thank You!!


apt-get install libmysqlclient-dev python-dev

Seemed to do the trick.

Mac OS X, First off yeah Ive already seen this pip install mysqlpython fails with EnvironmentError mysql_config not foundThe problemI am trying to Instead of using MySQL-Python, try using 'mysql-connector-python', it can be installed using pip install mysql-connector-python. More information on this can be found here and here. Manually find the location of 'mysql/bin', 'mysql_config', and 'MySQL-Python', and add all these to the $PATH environment variable.


There maybe various answers for the above issue, below is a aggregated solution.

For Ubuntu:

$ sudo apt update
$ sudo apt install python-dev
$ sudo apt install python-MySQLdb

For CentOS:

$ yum install python-devel mysql-devel

Error:pip install mysql-python fails with EnvironmentError, Then I got the error saying that MySQL is not installed. package mysql-python sh: mysql_config: not found Traceback (most recent call last):  pip uninstall mysql-python avait détruit le contenu du paquet debian, et bien sûr pip install mysql-python a échoué parce que le paquet debian n'avait pas besoin de fichiers dev. la bonne solution dans ce cas était apt-get install --reinstall python-mysqldb qui a restauré mysql-python à son état original.


If you are on MAC Install this globally

brew install mysql

then export path like this

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

Than globally or in your venv whatever you like

pip install MySQL-Python

Note: globally for python3 as Mac can have both python2 & 3

pip3 install MySQL-Python

pip install mysql python fails with EnvironmentError: mysql_config , pip install mysql python fails with EnvironmentError: mysql_config not found? pip install mysql-connector-python. @Volatil3 mysql-connector-python worked well  pip install mysql-python fails with EnvironmentError: mysql_config not found 1093 How to install packages using pip according to the requirements.txt file from a local directory?


Django error: vertualenv EnvironmentError: mysql_config not found , are using MacOS X pip install MySQL-python (error) echo "mysql_config I downloaded the Android SDK as a zip file and did not transfer it to /opt . However​  pip install django-codenerix Copy PIP instructions. Latest version. Released: Jun 25, 2020 Codenerix it is a framework that goes on top of Django so it makes easier


pip install error: EnvironmentError: mysql_config not found, MySQLdb is a python interface for mysql, but it is not mysql itself. And apparently mySQLdb needs the command 'mysql_config', so you need to install that first. Can you confirm that you did or did not install mysql itself, by running "mysql" from the shell? That should give you a response other than "mysql: command not found".


libs = mysql_config("libs_r") File "setup_posix.py", line 25, in mysql_config raise EnvironmentError("%s not found" % (mysql_config.path,)) EnvironmentError: mysql_config not found I searched on google lots way say need pip install libmysqlclient-dev or python-dev I tried them both but still not work Hope anyone can help me !