0

I'm trying to install MySQL-python with pip. I'm using Python v2.7.18 and pip v20.3.4

I'm trying it with:

pip install MySQL-python==1.2.5

But it gives this error:

Defaulting to user installation because normal site-packages is not writeable
Collecting MySQL-python==1.2.5
  Using cached MySQL-python-1.2.5.zip (108 kB)
    ERROR: Command errored out with exit status 1:
     command: /usr/bin/python -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-zuV7aL/mysql-python/setup.py'"'"'; __file__='"'"'/tmp/pip-install-zuV7aL/mysql-python/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-pip-egg-info-TefBrj
         cwd: /tmp/pip-install-zuV7aL/mysql-python/
    Complete output (10 lines):
    sh: 1: mysql_config: not found
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-install-zuV7aL/mysql-python/setup.py", line 17, 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 25, in mysql_config
        raise EnvironmentError("%s not found" % (mysql_config.path,))
    EnvironmentError: mysql_config not found
    ----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.

What am I doing wrong?

sundowatch
  • 3,012
  • 3
  • 38
  • 66
  • https://stackoverflow.com/search?q=%5Bmysql-python%5D+EnvironmentError%3A+mysql_config+not+found – phd Feb 10 '21 at 16:19

1 Answers1

1

You need to install dev libs for mysql client:

sudo apt-get install libmysqlclient-dev

Flash Thunder
  • 11,672
  • 8
  • 47
  • 91