mysql_config not found when installing mysqldb pyt

2019-01-01 12:07发布

I am trying to get a Python script to run on the linux server I'm connected to via ssh. The script uses mysqldb. I have all the other components I need, but when I try to install mySQLdb via setuptools like so:,

python setup.py install

I get the following error report related to the mysql_config command.

sh: mysql_config: command not found
Traceback (most recent call last):
  File "setup.py", line 15, in <module>
    metadata, options = get_config()
  File "/usr/lib/python2.5/MySQL-python-1.2.3/setup_posix.py", line 43, in get_config
    libs = mysql_config("libs_r")
  File "/usr/lib/python2.5/MySQL-python-1.2.3/setup_posix.py", line 24, in mysql_config
    raise EnvironmentError("%s not found" % (mysql_config.path,))
EnvironmentError: mysql_config not found

Has anyone else encountered this error and if so how did you resolve it/what can I do to successfully install mysqldb?

26条回答
人气声优
2楼-- · 2019-01-01 12:36

In centos 7 this works for me :

yum install mariadb-devel
pip install mysqlclient
查看更多
人气声优
3楼-- · 2019-01-01 12:37

On my Fedora 23 machine I had to run the following:

sudo dnf install mysql-devel
查看更多
登录 后发表回答