gpt4 book ai didi

python - 在 ubuntu 服务器上安装 mariadb 时出错

转载 作者:行者123 更新时间:2023-12-04 18:26:33 27 4
gpt4 key购买 nike

我尝试使用 pip install mariadb 安装 mariadb 模块,但出现这样的错误。

Collecting mariadb
Using cached https://files.pythonhosted.org/packages/15/73/250a30543f9987af2e3f7856f29917fa22580cd6b457b8e2df0d6d80b3f3/mariadb-1.0.1.tar.gz
Complete output from command python setup.py egg_info:
MariaDB Connector/Python requires MariaDB Connector/C >= 3.1.5, found version 3.0.3

----------------------------------------
Command "python setup.py egg_info" failed with error code 2 in /tmp/pip-build-f3yri8cs/mariadb/

我尝试运行 pip install --upgrade setuptools 然后运行 ​​pip install mariadb 但它仍然无法正常工作,那么我该如何解决这个问题?

最佳答案

我找到了这个问题的解决方案:因此,要运行 pip install mariadb,我遵循了以下步骤:

我使用的是 python3.9,而不是旧版本,

安装 Python 3.9:

sudo apt update
sudo apt install software-properties-common
sudo add-apt-repository ppa:deadsnakes/ppa
sudo apt install python3.9

安装 Pip3:

sudo apt install python3-pip

添加 mariadb 的 repo:

sudo apt-key adv --recv-keys --keyserver keyserver.ubuntu.com 0xcbcb082a1bb943db
curl -LsS https://downloads.mariadb.com/MariaDB/mariadb_repo_setup | sudo bash

如果您收到 apt-transport-https 的一些问题,请安装:

sudo apt-get install -y apt-transport-https

运行这些更新:

sudo apt-get update
sudo apt-get upgrade
sudo apt-get dist-upgrade

现在,您可以安装最新的 Connector/c:

sudo apt-get install libmariadb3
sudo apt-get install libmariadb-dev

最后,你可以运行:

sudo pip3 install mariadb

应该工作得很好,很抱歉发了这么长的帖子。

关于python - 在 ubuntu 服务器上安装 mariadb 时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63628125/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com