尝试使用pip3安装mariadb包时出错



我正试图在Ubuntu 2004服务器上的python 3.8环境中安装mariadbusin-pip3。

我确实下载了mariadb-connector-c(3.31版(,并将文件复制到了它们的目的地。

我还在系统上安装了python2-dev及其依赖项。

当我启动";CCD_ 1";是:

Collecting mariadb
Using cached mariadb-1.1.3.tar.gz (80 kB)
Preparing metadata (setup.py) ... done
Building wheels for collected packages: mariadb
Building wheel for mariadb (setup.py) ... error
error: subprocess-exited-with-error
× python setup.py bdist_wheel did not run successfully.
│ exit code: 1
╰─> [47 lines of output]
running bdist_wheel
running build
running build_py
creating build
creating build/lib.linux-x86_64-cpython-38
creating build/lib.linux-x86_64-cpython-38/mariadb
copying mariadb/__init__.py -> build/lib.linux-x86_64-cpython-38/mariadb
creating build/lib.linux-x86_64-cpython-38/mariadb/constants
copying mariadb/constants/__init__.py -> build/lib.linux-x86_64-cpython-38/mariadb/constants
copying mariadb/constants/CLIENT.py -> build/lib.linux-x86_64-cpython-38/mariadb/constants
copying mariadb/constants/CURSOR.py -> build/lib.linux-x86_64-cpython-38/mariadb/constants
copying mariadb/constants/STATUS.py -> build/lib.linux-x86_64-cpython-38/mariadb/constants
copying mariadb/constants/TPC_STATE.py -> build/lib.linux-x86_64-cpython-38/mariadb/constants
copying mariadb/constants/INFO.py -> build/lib.linux-x86_64-cpython-38/mariadb/constants
copying mariadb/field.py -> build/lib.linux-x86_64-cpython-38/mariadb
copying mariadb/connections.py -> build/lib.linux-x86_64-cpython-38/mariadb
copying mariadb/connectionpool.py -> build/lib.linux-x86_64-cpython-38/mariadb
copying mariadb/dbapi20.py -> build/lib.linux-x86_64-cpython-38/mariadb
copying mariadb/cursors.py -> build/lib.linux-x86_64-cpython-38/mariadb
copying mariadb/release_info.py -> build/lib.linux-x86_64-cpython-38/mariadb
copying mariadb/constants/ERR.py -> build/lib.linux-x86_64-cpython-38/mariadb/constants
copying mariadb/constants/FIELD_TYPE.py -> build/lib.linux-x86_64-cpython-38/mariadb/constants
copying mariadb/constants/FIELD_FLAG.py -> build/lib.linux-x86_64-cpython-38/mariadb/constants
copying mariadb/constants/INDICATOR.py -> build/lib.linux-x86_64-cpython-38/mariadb/constants
running build_ext
building 'mariadb._mariadb' extension
creating build/temp.linux-x86_64-cpython-38
creating build/temp.linux-x86_64-cpython-38/mariadb
x86_64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -fPIC -DPY_MARIADB_MAJOR_VERSION=1 -DPY_MARIADB_MINOR_VERSION=1 -DPY_MARIADB_PATCH_VERSION=3 -DPY_MARIADB_PRE_RELEASE_SEGMENT="" -I/usr/include/mariadb -I/usr/include/mariadb/mysql -I./include -I/var/sas/scrap_venv/include -I/usr/include/python3.8 -c mariadb/mariadb.c -o build/temp.linux-x86_64-cpython-38/mariadb/mariadb.o -DDEFAULT_PLUGINS_SUBDIR="/usr/lib/mariadb/plugin"
x86_64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -fPIC -DPY_MARIADB_MAJOR_VERSION=1 -DPY_MARIADB_MINOR_VERSION=1 -DPY_MARIADB_PATCH_VERSION=3 -DPY_MARIADB_PRE_RELEASE_SEGMENT="" -I/usr/include/mariadb -I/usr/include/mariadb/mysql -I./include -I/var/sas/scrap_venv/include -I/usr/include/python3.8 -c mariadb/mariadb_codecs.c -o build/temp.linux-x86_64-cpython-38/mariadb/mariadb_codecs.o -DDEFAULT_PLUGINS_SUBDIR="/usr/lib/mariadb/plugin"
x86_64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -fPIC -DPY_MARIADB_MAJOR_VERSION=1 -DPY_MARIADB_MINOR_VERSION=1 -DPY_MARIADB_PATCH_VERSION=3 -DPY_MARIADB_PRE_RELEASE_SEGMENT="" -I/usr/include/mariadb -I/usr/include/mariadb/mysql -I./include -I/var/sas/scrap_venv/include -I/usr/include/python3.8 -c mariadb/mariadb_connection.c -o build/temp.linux-x86_64-cpython-38/mariadb/mariadb_connection.o -DDEFAULT_PLUGINS_SUBDIR="/usr/lib/mariadb/plugin"
x86_64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -fPIC -DPY_MARIADB_MAJOR_VERSION=1 -DPY_MARIADB_MINOR_VERSION=1 -DPY_MARIADB_PATCH_VERSION=3 -DPY_MARIADB_PRE_RELEASE_SEGMENT="" -I/usr/include/mariadb -I/usr/include/mariadb/mysql -I./include -I/var/sas/scrap_venv/include -I/usr/include/python3.8 -c mariadb/mariadb_cursor.c -o build/temp.linux-x86_64-cpython-38/mariadb/mariadb_cursor.o -DDEFAULT_PLUGINS_SUBDIR="/usr/lib/mariadb/plugin"
mariadb/mariadb_cursor.c: In function ‘MrdbCursor_execute_binary’:
mariadb/mariadb_cursor.c:1094:48: error: ‘const struct st_mariadb_methods’ has no member named ‘db_execute_generate_request’
1094 |     if (!(buf= self->connection->mysql->methods->db_execute_generate_request(self->stmt, &buflen, 1)))
|                                                ^~
mariadb/mariadb_cursor.c:1058:20: warning: variable ‘buf’ set but not used [-Wunused-but-set-variable]
1058 |     unsigned char *buf= NULL;
|                    ^~~
mariadb/mariadb_cursor.c: In function ‘MrdbCursor_execute_bulk’:
mariadb/mariadb_cursor.c:1205:48: error: ‘const struct st_mariadb_methods’ has no member named ‘db_execute_generate_request’
1205 |     if (!(buf= self->connection->mysql->methods->db_execute_generate_request(self->stmt, &buflen, 1)))
|                                                ^~
mariadb/mariadb_cursor.c:1169:20: warning: variable ‘buf’ set but not used [-Wunused-but-set-variable]
1169 |     unsigned char *buf= NULL;
|                    ^~~
error: command '/usr/bin/x86_64-linux-gnu-gcc' failed with exit code 1
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for mariadb
Running setup.py clean for mariadb
Failed to build mariadb
Installing collected packages: mariadb
Running setup.py install for mariadb ... error
error: subprocess-exited-with-error
× Running setup.py install for mariadb did not run successfully.
│ exit code: 1
╰─> [49 lines of output]
running install
/var/sas/scrap_venv/lib/python3.8/site-packages/setuptools/command/install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
warnings.warn(
running build
running build_py
creating build
creating build/lib.linux-x86_64-cpython-38
creating build/lib.linux-x86_64-cpython-38/mariadb
copying mariadb/__init__.py -> build/lib.linux-x86_64-cpython-38/mariadb
creating build/lib.linux-x86_64-cpython-38/mariadb/constants
copying mariadb/constants/__init__.py -> build/lib.linux-x86_64-cpython-38/mariadb/constants
copying mariadb/constants/CLIENT.py -> build/lib.linux-x86_64-cpython-38/mariadb/constants
copying mariadb/constants/CURSOR.py -> build/lib.linux-x86_64-cpython-38/mariadb/constants
copying mariadb/constants/STATUS.py -> build/lib.linux-x86_64-cpython-38/mariadb/constants
copying mariadb/constants/TPC_STATE.py -> build/lib.linux-x86_64-cpython-38/mariadb/constants
copying mariadb/constants/INFO.py -> build/lib.linux-x86_64-cpython-38/mariadb/constants
copying mariadb/field.py -> build/lib.linux-x86_64-cpython-38/mariadb
copying mariadb/connections.py -> build/lib.linux-x86_64-cpython-38/mariadb
copying mariadb/connectionpool.py -> build/lib.linux-x86_64-cpython-38/mariadb
copying mariadb/dbapi20.py -> build/lib.linux-x86_64-cpython-38/mariadb
copying mariadb/cursors.py -> build/lib.linux-x86_64-cpython-38/mariadb
copying mariadb/release_info.py -> build/lib.linux-x86_64-cpython-38/mariadb
copying mariadb/constants/ERR.py -> build/lib.linux-x86_64-cpython-38/mariadb/constants
copying mariadb/constants/FIELD_TYPE.py -> build/lib.linux-x86_64-cpython-38/mariadb/constants
copying mariadb/constants/FIELD_FLAG.py -> build/lib.linux-x86_64-cpython-38/mariadb/constants
copying mariadb/constants/INDICATOR.py -> build/lib.linux-x86_64-cpython-38/mariadb/constants
running build_ext
building 'mariadb._mariadb' extension
creating build/temp.linux-x86_64-cpython-38
creating build/temp.linux-x86_64-cpython-38/mariadb
x86_64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -fPIC -DPY_MARIADB_MAJOR_VERSION=1 -DPY_MARIADB_MINOR_VERSION=1 -DPY_MARIADB_PATCH_VERSION=3 -DPY_MARIADB_PRE_RELEASE_SEGMENT="" -I/usr/include/mariadb -I/usr/include/mariadb/mysql -I./include -I/var/sas/scrap_venv/include -I/usr/include/python3.8 -c mariadb/mariadb.c -o build/temp.linux-x86_64-cpython-38/mariadb/mariadb.o -DDEFAULT_PLUGINS_SUBDIR="/usr/lib/mariadb/plugin"
x86_64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -fPIC -DPY_MARIADB_MAJOR_VERSION=1 -DPY_MARIADB_MINOR_VERSION=1 -DPY_MARIADB_PATCH_VERSION=3 -DPY_MARIADB_PRE_RELEASE_SEGMENT="" -I/usr/include/mariadb -I/usr/include/mariadb/mysql -I./include -I/var/sas/scrap_venv/include -I/usr/include/python3.8 -c mariadb/mariadb_codecs.c -o build/temp.linux-x86_64-cpython-38/mariadb/mariadb_codecs.o -DDEFAULT_PLUGINS_SUBDIR="/usr/lib/mariadb/plugin"
x86_64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -fPIC -DPY_MARIADB_MAJOR_VERSION=1 -DPY_MARIADB_MINOR_VERSION=1 -DPY_MARIADB_PATCH_VERSION=3 -DPY_MARIADB_PRE_RELEASE_SEGMENT="" -I/usr/include/mariadb -I/usr/include/mariadb/mysql -I./include -I/var/sas/scrap_venv/include -I/usr/include/python3.8 -c mariadb/mariadb_connection.c -o build/temp.linux-x86_64-cpython-38/mariadb/mariadb_connection.o -DDEFAULT_PLUGINS_SUBDIR="/usr/lib/mariadb/plugin"
x86_64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -fPIC -DPY_MARIADB_MAJOR_VERSION=1 -DPY_MARIADB_MINOR_VERSION=1 -DPY_MARIADB_PATCH_VERSION=3 -DPY_MARIADB_PRE_RELEASE_SEGMENT="" -I/usr/include/mariadb -I/usr/include/mariadb/mysql -I./include -I/var/sas/scrap_venv/include -I/usr/include/python3.8 -c mariadb/mariadb_cursor.c -o build/temp.linux-x86_64-cpython-38/mariadb/mariadb_cursor.o -DDEFAULT_PLUGINS_SUBDIR="/usr/lib/mariadb/plugin"
mariadb/mariadb_cursor.c: In function ‘MrdbCursor_execute_binary’:
mariadb/mariadb_cursor.c:1094:48: error: ‘const struct st_mariadb_methods’ has no member named ‘db_execute_generate_request’
1094 |     if (!(buf= self->connection->mysql->methods->db_execute_generate_request(self->stmt, &buflen, 1)))
|                                                ^~
mariadb/mariadb_cursor.c:1058:20: warning: variable ‘buf’ set but not used [-Wunused-but-set-variable]
1058 |     unsigned char *buf= NULL;
|                    ^~~
mariadb/mariadb_cursor.c: In function ‘MrdbCursor_execute_bulk’:
mariadb/mariadb_cursor.c:1205:48: error: ‘const struct st_mariadb_methods’ has no member named ‘db_execute_generate_request’
1205 |     if (!(buf= self->connection->mysql->methods->db_execute_generate_request(self->stmt, &buflen, 1)))
|                                                ^~
mariadb/mariadb_cursor.c:1169:20: warning: variable ‘buf’ set but not used [-Wunused-but-set-variable]
1169 |     unsigned char *buf= NULL;
|                    ^~~
error: command '/usr/bin/x86_64-linux-gnu-gcc' failed with exit code 1
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
error: legacy-install-failure
× Encountered error while trying to install package.
╰─> mariadb
note: This is an issue with the package mentioned above, not pip.
hint: See above for output from the failure.

有关于如何安装的提示吗?

最佳,apnow

由于setup.py没有声称缺少Connector/C版本(Connector/Python 1.1.x需要C/C 3.2.4(,因此似乎找到了mariadb_config(将用于检查安装的版本(,但有些地方是另一个mysql.h包含文件(来自旧的MariaDB连接器/C、MariaDB服务器或mysql安装(,它将被使用。

我建议检查构建的包含路径:

export CFLAGS="-v -E"
pip3 install mariadb >& output.txt

然后在您最喜欢的编辑器中打开output.txt并搜索";搜索从这里开始";在那里你可以看到构建的包含路径:

#include "..." search starts here:
#include <...> search starts here:
/usr/local/include/mariadb
/usr/local/include/mariadb/mysql
./include
/usr/local/include/python3.10
/usr/lib/gcc/x86_64-linux-gnu/10/include
/usr/local/include
/usr/include/x86_64-linux-gnu
/usr/include

@phd:我确实卸载了python2-dev(是的,不需要(

@Georg Ritcher:我确实删除了之前为MySQL连接安装的libmysqlclient。我还执行了你上面提到的命令,不知怎么的,它起了作用!

我确实收到了这个输出:

Collecting mariadb
Using cached MariaDB-1.1.3.tar.gz (80 kB)
Preparing metadata (setup.py): started
Preparing metadata (setup.py): finished with status 'done'
Building wheels for collected packages: mariadb
Building wheel for mariadb (setup.py): started
Building wheel for mariadb (setup.py): finished with status 'done'
Created wheel for mariadb: filename=mariadb-1.1.3-cp38-cp38-linux_x86_64.whl size=46386 sha256=fb15f61a17c9ff2ccc924c8c530bcf0817573498b9c4942feccbde7d7eaacceb
Stored in directory: /home/apnow/.cache/pip/wheels/cd/97/c7/77b7fa75c136ad230c5352abc75f29ae024da818057add5e7d
Successfully built mariadb
Installing collected packages: mariadb
Successfully installed mariadb-1.1.3

我现在可以看到mariadb 1.1.3安装在我的环境中。也许libmysqlclient影响了它的安装?

感谢大家的支持!

一切顺利,apnow

相关内容

  • 没有找到相关文章

最新更新