英文:
mariadb package installation difficulties
问题
这是在WSL (Ubuntu 20.04)中。
我已经设置了一个使用Python 3.10.10的虚拟环境(VE)。
我已经执行了apt install
命令以安装python3.10-venv、python3.10-dev、python3.10-minimal和python3.10-distutils。
我已经成功激活了虚拟环境并使用pip install
安装了一些包。但是我在安装mariadb时遇到了问题。
首先,当我执行pip install mariadb
时,出现了以下错误:
此错误通常表明未找到必须预先安装的依赖项MariaDB Connector/C。
然后,我执行了sudo apt install libmariadb3 libmariadb-dev
,然后出现了以下错误:
Connector/Python要求MariaDB Connector/C >= 3.3.1,但找到的版本是3.1.20。
因此,我从这里下载了一个tar.gz文件:mariadb-connector-c-3.3.4-ubuntu-jammy-amd64.tar.gz。
然后,我按照这里的说明,执行了"从源代码分发安装"部分的步骤。
解压后,我得到了以下内容:
(sysadmin_wsl) root@M17A:/mnt/d/apps/MariaDB/mariadb-connector-python# pip install ./mariadb-connector-c-3.3.4-ubuntu-jammy-amd64
错误:无法安装目录'./mariadb-connector-c-3.3.4-ubuntu-jammy-amd64'。未找到'setup.py'或'pyproject.toml'文件。
的确,这两个文件都不存在。
有什么建议吗?
英文:
This is in WSL (Ubuntu 20.04).
I've set up a Python VE with 3.10.10.
I've done apt install
of python3.10-venv, python3.10-dev, python3.10-minimal and python3.10-distutils.
I've managed to activate the VE and do pip install
with a few packages. But I'm having problems with mariadb.
First, when I went pip install mariadb
it complained
> This error typically indicates that MariaDB Connector/C, a dependency
> which
> must be preinstalled, is not found.
So then I went sudo apt install libmariadb3 libmariadb-dev
... and then it complained:
> Connector/Python requires MariaDB Connector/C >= 3.3.1, found version
> 3.1.20
So then I downloaded a tar.gz from here: mariadb-connector-c-3.3.4-ubuntu-jammy-amd64.tar.gz
Then I followed the instructions here, section "Install from source distribution".
After expanding I get this:
(sysadmin_wsl) root@M17A:/mnt/d/apps/MariaDB/mariadb-connector-python# pip install ./mariadb-connector-c-3.3.4-ubuntu-jammy-amd64
ERROR: Directory './mariadb-connector-c-3.3.4-ubuntu-jammy-amd64' is not installable. Neither 'setup.py' nor 'pyproject.toml' found.
Indeed, neither of these files is present.
Any suggestions?
答案1
得分: 1
有一个旧版本支持MariaDB Connector/C 3.1.5。它是在2020年7月15日提交的。所以你可以尝试安装那个旧的mariadb
。请参考https://pypi.org/project/mariadb/#history,靠近那个日期的版本有1.0.0和1.0.1。
所以我的建议是:尝试pip install "mariadb < 1.1"
。它应该安装mariadb==1.0.11
,应该没问题,参见https://github.com/mariadb-corporation/mariadb-connector-python/blob/v1.0.11/mariadb_posix.py#L45。
英文:
There was an old version that supports MariaDB Connector/C 3.1.5. It was committed on July 15, 2020. So you can try to install that old mariadb
. See https://pypi.org/project/mariadb/#history , versions that close to the date are 1.0.0 and 1.0.1.
So my advice: try pip install "mariadb < 1.1"
. It must install mariadb==1.0.11
which should be ok, see https://github.com/mariadb-corporation/mariadb-connector-python/blob/v1.0.11/mariadb_posix.py#L45
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论