小樱 发表于 2018/3/20 06:23

pip install pysqlite安装报错

# pip install pysqlite
Collecting pysqlite
Using cached pysqlite-2.8.3.tar.gz
Building wheels for collected packages: pysqlite
Running setup.py bdist_wheel for pysqlite ... error
Complete output from command /usr/local/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-dizXCQ/pysqlite/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d /tmp/tmp4ZjCBFpip-wheel- --python-tag cp27:
running bdist_wheel
running build
running build_py
creating build
creating build/lib.linux-x86_64-2.7
creating build/lib.linux-x86_64-2.7/pysqlite2
copying lib/dbapi2.py -> build/lib.linux-x86_64-2.7/pysqlite2
copying lib/__init__.py -> build/lib.linux-x86_64-2.7/pysqlite2
copying lib/dump.py -> build/lib.linux-x86_64-2.7/pysqlite2
creating build/lib.linux-x86_64-2.7/pysqlite2/test
copying lib/test/transactions.py -> build/lib.linux-x86_64-2.7/pysqlite2/test
copying lib/test/dbapi.py -> build/lib.linux-x86_64-2.7/pysqlite2/test
copying lib/test/regression.py -> build/lib.linux-x86_64-2.7/pysqlite2/test
copying lib/test/__init__.py -> build/lib.linux-x86_64-2.7/pysqlite2/test
copying lib/test/factory.py -> build/lib.linux-x86_64-2.7/pysqlite2/test
copying lib/test/userfunctions.py -> build/lib.linux-x86_64-2.7/pysqlite2/test
copying lib/test/types.py -> build/lib.linux-x86_64-2.7/pysqlite2/test
copying lib/test/hooks.py -> build/lib.linux-x86_64-2.7/pysqlite2/test
copying lib/test/dump.py -> build/lib.linux-x86_64-2.7/pysqlite2/test
running build_ext
building 'pysqlite2._sqlite' extension
creating build/temp.linux-x86_64-2.7
creating build/temp.linux-x86_64-2.7/src
gcc -pthread -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -DMODULE_NAME="pysqlite2.dbapi2" -IPackage -Isqlite3 -Iwas -Inot -Ifound -Iin -Ithe -Ipkg-config -Isearch -Ipath. -IPerhaps -Iyou -Ishould -Iadd -Ithe -Idirectory -Icontaining -I`sqlite3.pc' -Ito -Ithe -IPKG_CONFIG_PATH -Ienvironment -Ivariable -INo -Ipackage -I'sqlite3' -Ifound -I/usr/local/include/python2.7 -c src/module.c -o build/temp.linux-x86_64-2.7/src/module.o
在包含自 src/module.c:24 的文件中:
src/connection.h:33:21: 错误:sqlite3.h:没有那个文件或目录
In file included from src/module.c:24:
src/connection.h:38: 错误:expected specifier-qualifier-list before ‘sqlite3’
In file included from src/module.c:25:
src/statement.h:37: 错误:expected specifier-qualifier-list before ‘sqlite3’
src/module.c: 在函数‘module_connect’中:
src/module.c:63: 错误:‘SQLITE_OPEN_READWRITE’未声明(在此函数内第一次使用)
src/module.c:63: 错误:(即使在一个函数内多次出现,每个未声明的标识符在其
src/module.c:63: 错误:所在的函数内也只报告一次。)
src/module.c:63: 错误:‘SQLITE_OPEN_CREATE’未声明(在此函数内第一次使用)
src/module.c: 在函数‘module_complete’中:
src/module.c:102: 警告:隐式声明函数‘sqlite3_complete’
src/module.c: 在函数‘init_sqlite’中:
src/module.c:401: 警告:隐式声明函数‘sqlite3_libversion’
src/module.c:401: 警告:传递‘PyString_FromString’的第 1 个参数时将整数赋给指针,未作类型转换
/usr/local/include/python2.7/stringobject.h:63: 附注:需要类型‘const char *’,但实参的类型为‘int’
error: command 'gcc' failed with exit status 1

----------------------------------------
Failed building wheel for pysqlite
Running setup.py clean for pysqlite
Failed to build pysqlite
Installing collected packages: pysqlite
Running setup.py install for pysqlite ... error
    Complete output from command /usr/local/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-dizXCQ/pysqlite/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-e6pGJC-record/install-record.txt --single-version-externally-managed --compile:
    running install
    running build
    running build_py
    creating build
    creating build/lib.linux-x86_64-2.7
    creating build/lib.linux-x86_64-2.7/pysqlite2
    copying lib/dbapi2.py -> build/lib.linux-x86_64-2.7/pysqlite2
    copying lib/__init__.py -> build/lib.linux-x86_64-2.7/pysqlite2
    copying lib/dump.py -> build/lib.linux-x86_64-2.7/pysqlite2
    creating build/lib.linux-x86_64-2.7/pysqlite2/test
    copying lib/test/transactions.py -> build/lib.linux-x86_64-2.7/pysqlite2/test
    copying lib/test/dbapi.py -> build/lib.linux-x86_64-2.7/pysqlite2/test
    copying lib/test/regression.py -> build/lib.linux-x86_64-2.7/pysqlite2/test
    copying lib/test/__init__.py -> build/lib.linux-x86_64-2.7/pysqlite2/test
    copying lib/test/factory.py -> build/lib.linux-x86_64-2.7/pysqlite2/test
    copying lib/test/userfunctions.py -> build/lib.linux-x86_64-2.7/pysqlite2/test
    copying lib/test/types.py -> build/lib.linux-x86_64-2.7/pysqlite2/test
    copying lib/test/hooks.py -> build/lib.linux-x86_64-2.7/pysqlite2/test
    copying lib/test/dump.py -> build/lib.linux-x86_64-2.7/pysqlite2/test
    running build_ext
    building 'pysqlite2._sqlite' extension
    creating build/temp.linux-x86_64-2.7
    creating build/temp.linux-x86_64-2.7/src
    gcc -pthread -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -DMODULE_NAME="pysqlite2.dbapi2" -IPackage -Isqlite3 -Iwas -Inot -Ifound -Iin -Ithe -Ipkg-config -Isearch -Ipath. -IPerhaps -Iyou -Ishould -Iadd -Ithe -Idirectory -Icontaining -I`sqlite3.pc' -Ito -Ithe -IPKG_CONFIG_PATH -Ienvironment -Ivariable -INo -Ipackage -I'sqlite3' -Ifound -I/usr/local/include/python2.7 -c src/module.c -o build/temp.linux-x86_64-2.7/src/module.o
    在包含自 src/module.c:24 的文件中:
    src/connection.h:33:21: 错误:sqlite3.h:没有那个文件或目录
    In file included from src/module.c:24:
    src/connection.h:38: 错误:expected specifier-qualifier-list before ‘sqlite3’
    In file included from src/module.c:25:
    src/statement.h:37: 错误:expected specifier-qualifier-list before ‘sqlite3’
    src/module.c: 在函数‘module_connect’中:
    src/module.c:63: 错误:‘SQLITE_OPEN_READWRITE’未声明(在此函数内第一次使用)
    src/module.c:63: 错误:(即使在一个函数内多次出现,每个未声明的标识符在其
    src/module.c:63: 错误:所在的函数内也只报告一次。)
    src/module.c:63: 错误:‘SQLITE_OPEN_CREATE’未声明(在此函数内第一次使用)
    src/module.c: 在函数‘module_complete’中:
    src/module.c:102: 警告:隐式声明函数‘sqlite3_complete’
    src/module.c: 在函数‘init_sqlite’中:
    src/module.c:401: 警告:隐式声明函数‘sqlite3_libversion’
    src/module.c:401: 警告:传递‘PyString_FromString’的第 1 个参数时将整数赋给指针,未作类型转换
    /usr/local/include/python2.7/stringobject.h:63: 附注:需要类型‘const char *’,但实参的类型为‘int’
    error: command 'gcc' failed with exit status 1
   
    ----------------------------------------
Command "/usr/local/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-dizXCQ/pysqlite/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-e6pGJC-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-dizXCQ/pysqlite/


解决方法
yum -y install sqlite-devel
pip install pysqlite

页: [1]
查看完整版本: pip install pysqlite安装报错