python - 我们的sql安装: error: command 'x86_64-linux-gnu-gcc' failed with exit status 1

标签 python python-3.x python-3.5 oursql

我已经解决了之前的大部分错误,并且已经安装在 python 3.5 virtualenv 中: python3-dev libmysqlclient-dev libmariadb-客户端-lgpl-dev libmariadb-client-lgpl-dev-compat

但是

sudo pip install oursql

仍然出现此错误:

Installing collected packages: oursql
  Running setup.py install for oursql ... error
    Complete output from command /usr/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-

build-fHedbn/oursql/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r

\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-V5ljoT-record/install-record.txt --single-

version-externally-managed --compile:
    cython not found, using previously-cython'd .c file.
    running install
    running build
    running build_ext
    building 'oursql' extension
    mysql_config --cflags
    creating build
    creating build/temp.linux-x86_64-2.7
    creating build/temp.linux-x86_64-2.7/oursqlx
    x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing 

-Wdate-time -D_FORTIFY_SOURCE=2 -g -fstack-protector-strong -Wformat -Werror=format-security -fPIC -

I/usr/include/python2.7 -c oursqlx/oursql.c -o build/temp.linux-x86_64-2.7/oursqlx/oursql.o -

I/usr/include/mysql -fabi-version=2 -fno-omit-frame-pointer
    In file included from /usr/include/mysql/mysql.h:64:0,
                     from oursqlx/compat.h:13,
                     from oursqlx/oursql.c:235:
    /usr/include/mysql/mysql/client_plugin.h:97:3: warning: function declaration isn’t a prototype [-

Wstrict-prototypes]
       MYSQL_CLIENT_PLUGIN_HEADER
       ^
    In file included from /usr/include/mysql/mysql.h:64:0,
                     from oursqlx/compat.h:13,
                     from oursqlx/oursql.c:235:
    /usr/include/mysql/mysql/client_plugin.h:107:3: warning: function declaration isn’t a prototype [-

Wstrict-prototypes]
       MYSQL_CLIENT_PLUGIN_HEADER
       ^
    oursqlx/oursql.c: In function ‘__pyx_pf_6oursql_6Cursor_4callproc’:
    oursqlx/oursql.c:16330:13: warning: variable ‘__pyx_v_params’ set but not used [-Wunused-but-set-

variable]
       PyObject *__pyx_v_params = 0;
                 ^
    oursqlx/oursql.c:16329:13: warning: variable ‘__pyx_v_procname’ set but not used [-Wunused-but-set-

variable]
       PyObject *__pyx_v_procname = 0;
                 ^
    oursqlx/oursql.c: In function ‘__pyx_pf_6oursql_6Cursor_14setoutputsize’:
    oursqlx/oursql.c:18140:13: warning: variable ‘__pyx_v_column’ set but not used [-Wunused-but-set-

variable]
       PyObject *__pyx_v_column = 0;
                 ^
    oursqlx/oursql.c:18139:13: warning: variable ‘__pyx_v_size’ set but not used [-Wunused-but-set-

variable]
       PyObject *__pyx_v_size = 0;
                 ^
    oursqlx/oursql.c: In function ‘__pyx_pf_6oursql_6Cursor_16__exit__’:
    oursqlx/oursql.c:18245:13: warning: variable ‘__pyx_v_tb’ set but not used [-Wunused-but-set-variable]
       PyObject *__pyx_v_tb = 0;
                 ^
    oursqlx/oursql.c:18244:13: warning: variable ‘__pyx_v_value’ set but not used [-Wunused-but-set-

variable]
       PyObject *__pyx_v_value = 0;
                 ^
    x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing 

-Wdate-time -D_FORTIFY_SOURCE=2 -g -fstack-protector-strong -Wformat -Werror=format-security -fPIC -

I/usr/include/python2.7 -c oursqlx/compat.c -o build/temp.linux-x86_64-2.7/oursqlx/compat.o -

I/usr/include/mysql -fabi-version=2 -fno-omit-frame-pointer
    In file included from /usr/include/mysql/mysql.h:64:0,
                     from oursqlx/compat.h:13,
                     from oursqlx/compat.c:1:
    /usr/include/mysql/mysql/client_plugin.h:97:3: warning: function declaration isn’t a prototype [-

Wstrict-prototypes]
       MYSQL_CLIENT_PLUGIN_HEADER
       ^
    In file included from /usr/include/mysql/mysql.h:64:0,
                     from oursqlx/compat.h:13,
                     from oursqlx/compat.c:1:
    /usr/include/mysql/mysql/client_plugin.h:107:3: warning: function declaration isn’t a prototype [-

Wstrict-prototypes]
       MYSQL_CLIENT_PLUGIN_HEADER
       ^
    In file included from oursqlx/compat.c:55:0:
    oursqlx/_exceptions.c: In function ‘_oursqlx_exc_from_errno’:
    oursqlx/_exceptions.c:620:24: error: ‘ER_ERROR_FIRST’ undeclared (first use in this function)
                 if (err >= ER_ERROR_FIRST && err <= ER_ERROR_LAST)
                            ^
    oursqlx/_exceptions.c:620:24: note: each undeclared identifier is reported only once for each function 

it appears in
    oursqlx/_exceptions.c:620:49: error: ‘ER_ERROR_LAST’ undeclared (first use in this function)
                 if (err >= ER_ERROR_FIRST && err <= ER_ERROR_LAST)
                                                     ^
    error: command 'x86_64-linux-gnu-gcc' failed with exit status 1

    ----------------------------------------
Command "/usr/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-

fHedbn/oursql/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', 

'\n'), __file__, 'exec'))" install --record /tmp/pip-V5ljoT-record/install-record.txt --single-version-

externally-managed --compile" failed with error code 1 in /tmp/pip-build-fHedbn/oursql/

非常感谢任何帮助!

最佳答案

这可能是由于 MySQL 5.7 的更新所致。一些常量被删除,这破坏了 oursql 构建。看这个pull request in oursql .

升级到 oursql >= 0.9.3.2 应该可以解决此问题。

请注意,此 0.9.3.2 无法使用 MariaDB 10 进行构建。您必须使用 0.9.3.1

关于python - 我们的sql安装: error: command 'x86_64-linux-gnu-gcc' failed with exit status 1,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36989922/

相关文章:

python - 如何使用 yum Python 模块获取在接受交易之前将下载的软件包列表?

python - Psychopy中的图像渲染问题

docker - 如何在已经安装了Python 3.4的Docker容器中升级到Python 3.5? (我在 Ubuntu 20.04 上运行 Docker 容器)

python - 将curl转换为urllib python3

python - 无法从 QVBoxLayout 中删除边距

python - 使用 python 集的 AggregateBykey

python - Python 的 subprocess.Popen 是否接受路径中的空格?

python - 奇怪的行为正则表达式

python - 无法使用 Python 3 安装 pyDNS。命令 "python setup.py egg_info"失败

django - 当您将项目上传到托管服务时,mysql 如何与 django 一起工作?