美文网首页
ubuntu安装mysqlclient错误解决

ubuntu安装mysqlclient错误解决

作者: 临界最终散射面 | 来源:发表于2018-05-18 10:00 被阅读0次

    mysqlclient is a python library that you need to connect to a MySQL database using MySQLdb. However, when you install mysqlclient on ubuntu 16.04 LTS, you may get the following error:

    $ pip install mysqlclient

    Collecting mysqlclient  Using cached mysqlclient-1.3.10.tar.gz    Complete output fromcommand python setup.py egg_info:    /bin/sh: 1: mysql_config: not found    Traceback(most recent call last):      File"", line 1,in      File"/tmp/pip-build-58kk7s2k/mysqlclient/setup.py", line 17,in        metadata, options=get_config()File"/tmp/pip-build-58kk7s2k/mysqlclient/setup_posix.py", line 44,in get_config        libs=mysql_config("libs_r")File"/tmp/pip-build-58kk7s2k/mysqlclient/setup_posix.py", line 26,in mysql_config        raise EnvironmentError("%s not found"%(mysql_config.path,))OSError: mysql_config not found----------------------------------------Command"python setup.py egg_info"failed with error code 1in/tmp/pip-build-58kk7s2k/mysqlclient/

    So, the message says that mysql_config is not found.

    At first glance, I thought that this must be some kind of a configuration file. However, it is actually a program for a Unix-based OS’s that you need to connect to a MySQL db. (See here for more details.)

    The mysql_config program is provided in the central repository, so you can easily get mysql_config by executing

    $ sudo apt install libmysqlclient-dev

    Now, you can install mysqlclient without any problem.

    $ pip install mysqlclient

    相关文章

      网友评论

          本文标题:ubuntu安装mysqlclient错误解决

          本文链接:https://www.haomeiwen.com/subject/wyiwdftx.html