【问题标题】:Problem with pip install mariadb - mariadb_config not foundpip install mariadb 的问题 - mariadb_config 未找到
【发布时间】:2020-07-22 04:42:48
【问题描述】:

我一直试图在运行 ubuntu 18.04 的树莓派上运行 pip3 install mariadb,但没有成功。

我已尝试按照其他答案中的建议安装以下软件包:

sudo apt-get install mariadb-server
sudo apt-get install libmariadbclient-dev
sudo apt-get install libmysqlclient-dev

pip3 install mysqlclient
pip3 install mysql-connector-python-rf

但是,我仍然遇到如图所示的问题:

ubuntu@ubuntu:~$ pip3 install mariadb
Collecting mariadb
  Using cached https://files.pythonhosted.org/packages/8f/c9/7050899dc1066409a17e1147d3afe1b078e582afdb755c6d3cb9c9a5c3ab/mariadb-1.0.0.tar.gz
    Complete output from command python setup.py egg_info:
    /bin/sh: 1: mariadb_config: not found
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-build-2gdw_t_r/mariadb/setup.py", line 26, in <module>
        cfg = get_config(options)
      File "/tmp/pip-build-2gdw_t_r/mariadb/mariadb_posix.py", line 49, in get_config
        cc_version = mariadb_config(config_prg, "cc_version")
      File "/tmp/pip-build-2gdw_t_r/mariadb/mariadb_posix.py", line 27, in mariadb_config
        "mariadb_config not found.\nPlease make sure, that MariaDB Connector/C is installed on your system, edit the configuration file 'site.cfg' and set the 'mariadb_config'\noption, which should point to the mariadb_config utility.")
    OSError: mariadb_config not found.
    Please make sure, that MariaDB Connector/C is installed on your system, edit the configuration file 'site.cfg' and set the 'mariadb_config'
    option, which should point to the mariadb_config utility.
    
    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-2gdw_t_r/mariadb/

我确实有/etc/mysql/my.cnf 文件。

【问题讨论】:

    标签: mysql python-3.x pip raspberry-pi mariadb


    【解决方案1】:

    您可能需要安装 MariaDB 数据库开发文件:https://packages.debian.org/unstable/libmariadb-dev。你需要这个包让你的 python 连接器在 linux 中正常工作。您需要按照以下步骤操作:

    1. sudo apt-get update -y
    2. sudo apt-get install -y libmariadb-dev
    3. pip3 install mariadb

    在这里,您首先更新需要升级系统的软件包列表。然后您正在安装前面提到的开发库。最后一步是使用 pip3 安装 mariadb,现在应该可以正常工作了。

    【讨论】:

    • 这对我不起作用
    • 如果您分享您收到的错误消息,我们可能会为您提供帮助
    • Mariadb 的网站说明 - 不起作用。多个指南 - 没有工作。此评论 - 有效。
    【解决方案2】:

    在 Mac 上,您需要先安装 mariadb-connector-c,这可以使用 brew 来完成:

    brew install mariadb-connector-c
    

    然后就可以安装mysqlclient:

    pip3 install mysqlclient
    

    【讨论】:

      【解决方案3】:

      看来你没有正确安装 MariaDB Connector/C,在 Ubuntu 上 mariadb_config 应该在 /usr/bin 中找到。

      另请注意,MariaDB Connector/Python 需要 MariaDB Connector/C 3.1.5 或更高版本,afaik Ubuntu 18.04 提供 3.0.3 - 所以最简单的方法是下载 Connector/C 源代码并手动构建。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 2014-06-19
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2013-07-18
        • 2022-11-08
        • 2020-05-29
        相关资源
        最近更新 更多