Python3 编译后缺少 sqlite3

2022-01-04 00:00:00 python python-3.x compilation sqlite

我的问题很像其他几个问题.手动编译 Python 后,缺少 sqlite3:

My question is much like several others. Having manually compiled Python, sqlite3 is missing:

主要区别在于我使用的是 Debian Linux 系统(与此问题不同:OS X 10.8.2 python 3 import sqlite错误)和Python3(与此问题和其他一系列问题不同:无法使用Python 2.6导入SQLite).

The main difference is that I'm using a Debian Linux system (unlike in this question: OS X 10.8.2 python 3 import sqlite error), and Python3 (unlike in this and a bunch of other questions: Cannot import SQLite with Python 2.6).

我希望能得到一些关于故障排除方向的指导.根据一些 Linux-but-older-Python 问题,我遇到的错误可能是由链接过程中缺少的资源(_sqlite3.so).我的系统上有两个这样的文件,它们都在较旧的 Python 安装中,但与 Python3 无关.还是其中之一足够好?或者他们说要安装 libsqlite3-dev 包,然后重新编译 Python.我这样做了,但我不知道在我的系统上安装这个包会如何影响编译过程.事实上,它没有.第二次编译给了我第二个没有 sqlite3 的 Python.

I was hoping for some guidance on which direction to troubleshoot in. According to some of the Linux-but-older-Python questions, an error like the one I'm getting could be caused by a missing resource during linking or something (_sqlite3.so). I have two such files on my system, both of them in older Python installations, ... but nothing related to Python3. Or is one of these good enough? Or they say to install the libsqlite3-dev package, then to re-compile Python. I did this, but I don't see how just having this package on my system will affect the compilation process. And indeed, it didn't. A second compile gave me a second Python without sqlite3.

我希望我可以只做 apt-get install python3,但是 Debian 就其稳定性而言,只有 Python 3.2,我需要最新版本.想法?

I wish I could just do apt-get install python3, but Debian, in its stability, only has Python 3.2, where I need the latest version. Thoughts?

推荐答案

您需要安装 libsqlite3(基于 Debian)或 sqlite-devel(基于 RedHat)和在编译 Python 之前关联头文件,因为 Python 需要在编译过程中找到它们.

You need to install libsqlite3 (Debian based) or sqlite-devel (RedHat based) and the associated header files before compiling Python because Python needs to find them during the compile process.

你确定运行了吗:

  1. ./configure
  2. 制作
  3. 进行安装

按照这个特定的顺序?没有遗漏的步骤?

In this specific order? With no missing steps?

相关文章