Ubuntu 17:无法安装mysqlclien

2024-06-16 09:47:12 发布

您现在位置:Python中文网/ 问答频道 /正文

尝试遵循Django教程,但我无法安装mysqlclient。在

本教程声称我可以使用以下命令执行此操作:

pip install mysqlclient

但这会产生以下错误:

Collecting mysqlclient   Using cached mysqlclient-1.3.12.tar.gz
    Complete output from command python setup.py egg_info:
    /bin/sh: 1: mysql_config: not found
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-build-rrolctwh/mysqlclient/setup.py", line 17, in <module>
        metadata, options = get_config()
      File "/tmp/pip-build-rrolctwh/mysqlclient/setup_posix.py", line 44, in get_config
        libs = mysql_config("libs_r")
      File "/tmp/pip-build-rrolctwh/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 1 in /tmp/pip-build-rrolctwh/mysqlclient/

我安装了最新的pip和virtualenv。在

{1}我想继续安装cd1>。在


Tags: pipinpybuildconfigsetuplinemysql
3条回答

您还应该安装mysql和python开发头和库: https://github.com/PyMySQL/mysqlclient-python#prerequisites

我也遇到了同样的问题,但是按照Official mysqlclient documentation中的说明为我解决了这个问题

只是从一个虚拟的python环境中运行 在安装了先决条件后,一切正常

我在Centos 6上也遇到过类似的问题,mysql迁移到maria时出现了问题,我遇到了一些冲突,但最后我安装了:

 yum list installed |grep MariaDB
MariaDB-client.x86_64  10.2.7-1.el6     @bull                                   
MariaDB-common.x86_64  10.2.7-1.el6     @bull                                   
MariaDB-compat.x86_64  10.2.7-1.el6     @bull                                   
MariaDB-devel.x86_64   10.2.7-1.el6     @bull                                   
MariaDB-server.x86_64  10.2.7-1.el6     @bull  

问题就解决了。在

相关问题 更多 >