未安装 MariaDB Connector/C

未安装 MariaDB Connector/C

我运行的是 Ubuntu 22.04.1,并且已经安装了

apt install mariadb-client
apt install python-is-python3
apt install python3-pip

现在我想安装

pip3 install mariadb

我收到这个错误

testdns:~ # pip3 install mariadb
Collecting mariadb
  Using cached mariadb-1.1.4.zip (97 kB)
  Preparing metadata (setup.py) ... error
  error: subprocess-exited-with-error
  
  × python setup.py egg_info did not run successfully.
  │ exit code: 1
  ╰─> [19 lines of output]
      /bin/sh: 1: mariadb_config: not found
      Traceback (most recent call last):
        File "<string>", line 2, in <module>
        File "<pip-setuptools-caller>", line 34, in <module>
        File "/tmp/pip-install-qky_da14/mariadb_e832618ff3c74f408e9a89ba04e06286/setup.py", line 27, in <module>
          cfg = get_config(options)
        File "/tmp/pip-install-qky_da14/mariadb_e832618ff3c74f408e9a89ba04e06286/mariadb_posix.py", line 62, in get_config
          cc_version = mariadb_config(config_prg, "cc_version")
        File "/tmp/pip-install-qky_da14/mariadb_e832618ff3c74f408e9a89ba04e06286/mariadb_posix.py", line 28, in mariadb_config
          raise EnvironmentError(
      OSError: mariadb_config not found.
      
      This error typically indicates that MariaDB Connector/C, a dependency which
      must be preinstalled, is not found.
      If MariaDB Connector/C is not installed, see installation instructions
      If MariaDB Connector/C is installed, either set the environment variable
      MARIADB_CONFIG or edit the configuration file 'site.cfg' to set the
       'mariadb_config' option to the file location of the mariadb_config utility.
      
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

× Encountered error while generating package metadata.
╰─> See above for output.

note: This is an issue with the package mentioned above, not pip.
hint: See above for details.

如何克服这个问题?

答案1

我从 Mariadb 页面找到了这个命令

sudo apt 安装 libmariadb3 libmariadb-dev

它对我有用

相关内容