无法使用sqlite3在centos 5上编译python3.7

时间:2018-11-22 17:22:52

标签: python-3.x sqlite centos python-3.7 centos5

尝试在centos 5上编译python3.7.1时收到错误,

Failed to build these modules:
_sqlite3

进一步检查编译日志并找到以下几行

building '_sqlite3' extension
creating build/temp.linux-x86_64-3.7/usr/local/src/Python-3.7.1/Modules/_sqlite
/usr/bin/gcc44 -pthread -fPIC -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -std=c99 -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -Werror=implicit-function-declaration -DMODULE_NAME="sqlite3" -IModules/_sqlite -I/usr/include -I./Include -I. -I/usr/local/include -I/usr/local/src/Python-3.7.1/Include -I/usr/local/src/Python-3.7.1 -c /usr/local/src/Python-3.7.1/Modules/_sqlite/cache.c -o build/temp.linux-x86_64-3.7/usr/local/src/Python-3.7.1/Modules/_sqlite/cache.o
/usr/bin/gcc44 -pthread -fPIC -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -std=c99 -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -Werror=implicit-function-declaration -DMODULE_NAME="sqlite3" -IModules/_sqlite -I/usr/include -I./Include -I. -I/usr/local/include -I/usr/local/src/Python-3.7.1/Include -I/usr/local/src/Python-3.7.1 -c /usr/local/src/Python-3.7.1/Modules/_sqlite/connection.c -o build/temp.linux-x86_64-3.7/usr/local/src/Python-3.7.1/Modules/_sqlite/connection.o
/usr/local/src/Python-3.7.1/Modules/_sqlite/connection.c: In function ‘_pysqlite_connection_begin’:
/usr/local/src/Python-3.7.1/Modules/_sqlite/connection.c:387: error: implicit declaration of function ‘sqlite3_prepare_v2’

已同时使用/usr/bin/gcc44sqlite-devel软件包。我想知道在从源代码编译python时是否还有其他人遇到这样的问题,以及是否有任何可用于此编译问题的解决方案。

1 个答案:

答案 0 :(得分:1)

问题是sqlite版本非常旧。我不得不编译最新的sqlite3,然后编译运行良好的python3.7。