gcc - pip install pysqlite 导致以下错误 : command 'x86_64-linux-gnu-gcc' failed with exit status 1 and `#include "sqlite3. h"`

标签 gcc pip pysqlite

pip install pysqlite失败,并输出以下错误日志:

➜  ~  pip install pysqlite
Collecting pysqlite
  Using cached pysqlite-2.6.3.tar.gz
Installing collected packages: pysqlite
  Running setup.py install for pysqlite
    Complete output from command /home/nathan/.virtualenvs/tox/bin/python -c "import setuptools, tokenize;__file__='/tmp/pip-build-KwYD65/pysqlite/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-K7uywC-record/install-record.txt --single-version-externally-managed --compile --install-headers /home/nathan/.virtualenvs/tox/include/site/python2.7/pysqlite:
    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/__init__.py -> build/lib.linux-x86_64-2.7/pysqlite2
    copying lib/dump.py -> build/lib.linux-x86_64-2.7/pysqlite2
    copying lib/dbapi2.py -> build/lib.linux-x86_64-2.7/pysqlite2
    creating 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/userfunctions.py -> 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/factory.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/__init__.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/dump.py -> build/lib.linux-x86_64-2.7/pysqlite2/test
    copying lib/test/dbapi.py -> build/lib.linux-x86_64-2.7/pysqlite2/test
    creating build/lib.linux-x86_64-2.7/pysqlite2/test/py25
    copying lib/test/py25/__init__.py -> build/lib.linux-x86_64-2.7/pysqlite2/test/py25
    copying lib/test/py25/py25tests.py -> build/lib.linux-x86_64-2.7/pysqlite2/test/py25
    running build_ext
    building 'pysqlite2._sqlite' extension
    creating build/temp.linux-x86_64-2.7
    creating build/temp.linux-x86_64-2.7/src
    x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -D_FORTIFY_SOURCE=2 -g -fstack-protector-strong -Wformat -Werror=format-security -fPIC -DMODULE_NAME="pysqlite2.dbapi2" -DSQLITE_OMIT_LOAD_EXTENSION=1 -I/usr/include/python2.7 -c src/module.c -o build/temp.linux-x86_64-2.7/src/module.o
    In file included from src/module.c:24:0:
    src/connection.h:33:21: fatal error: sqlite3.h: No such file or directory
     #include "sqlite3.h"
                         ^
    compilation terminated.
    error: command 'x86_64-linux-gnu-gcc' failed with exit status 1

    ----------------------------------------
Command "/home/nathan/.virtualenvs/tox/bin/python -c "import setuptools, tokenize;__file__='/tmp/pip-build-KwYD65/pysqlite/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-K7uywC-record/install-record.txt --single-version-externally-managed --compile --install-headers /home/nathan/.virtualenvs/tox/include/site/python2.7/pysqlite" failed with error code 1 in /tmp/pip-build-KwYD65/pysqlite
 ➜  ~
快速浏览了 stackoverflow 村的其余部分,发现了这个:
"error: command 'x86_64-linux-gnu-gcc' failed with exit status 1" in virtualenv
看起来很相似,但与sqlite没有太大关系。无论如何,那里提供的解决方案对这个问题不起作用。
我已经使用 sudo apt-get install sqlite 安装了 sqlite , sqlite3 使用 sudo apt-get instal sqlite3并使用 sudo apt-get install sqlitebrowser 安装了 sqlitebrowser .
enter image description here
zsh 自动完成功能为我提供了 SQLite 的其他几个选项,但它们大多看起来像文档或不相关的专用扩展。
我使用 Aptitude 搜索了可能的其他依赖项,如下( aptitude search sqlite ):
http://0bin.net/paste/-uv52OUbPGa5t-RJ#6VI1bgLbKqdhTUwBue0pO9yF63F3yfF++GtozB0ZI7S
我不认为在列表中安装任何我喜欢的库并在此过程中每次尝试,当我确定其他人以前遇到过这个问题时,这是不明智的。
PySQLite 文档似乎也没有太多关于 Debian 依赖项的信息。
https://readthedocs.org/search/project/?q=dependency&selected_facets=project_exact%3Apysqlite
我的理论是我只需要合适的图书馆。如果您不知道应该用哪个正确的答案来回答,请随时发表评论并提供有关如何更高效地开始搜索的建议。
如何修复 command 'x86_64-linux-gnu-gcc' failed with exit status 1 ... #include "sqlite3.h" pip install pysqlite 的 gcc 编译步骤错误?

最佳答案

没有这样的标题,也许你忘了安装主题:)
linux 使用 libsqlite3-dev 单独安装它们

sudo apt-get install libsqlite3-dev

关于gcc - pip install pysqlite 导致以下错误 : command 'x86_64-linux-gnu-gcc' failed with exit status 1 and `#include "sqlite3. h"`,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30900783/

相关文章:

python - 无法在 Ubuntu 18.04 上创建 python 虚拟环境

python - 在通过 pip 安装软件包之前使用 apt-get 构建依赖项?

python - 如何在 pysqlite 中启用事务性 DDL?

python - "%s"% 格式与 "{0}".format() 与 "?"格式

c - 编译器优化应用于哪个级别?

c - Valgrind 报告空 C 程序的未初始化值

c++ - gcc 4.7 中的错误?与否,我不确定所以我在这里问

gcc - 如何在GNU汇编器中将函数或标签的地址加载到寄存器中

python - 安装具有依赖项的 python 包时如何在 PIP 上指定版本

Python sqlite 将表从一个数据库复制到另一个数据库