Python 2.7 Python 3.6:没有名为'_sqlite3';

Python 2.7 Python 3.6:没有名为'_sqlite3';,python-2.7,python-3.x,ubuntu-16.04,Python 2.7,Python 3.x,Ubuntu 16.04,我有两个版本的python在Ubuntu 16.02上运行2.7和3.6 使用Python2.7,以下代码将成功运行 # will compile successfully import sqlite3 但是当使用Python3.7时,下面的代码将抛出-没有名为_sqlite3error的模块 # will throw no module error import sqlite3 这个问题有什么解决办法吗? 您是如何安装Python 3.6的?安装libsqlite3 dev头文件后,需要重

我有两个版本的python在Ubuntu 16.02上运行2.7和3.6

使用Python2.7,以下代码将成功运行

# will compile successfully
import sqlite3
但是当使用Python3.7时,下面的代码将抛出-没有名为_sqlite3error的模块

# will throw no module error
import sqlite3
这个问题有什么解决办法吗?

您是如何安装Python 3.6的?安装libsqlite3 dev头文件后,需要重新编译扩展模块。谢谢@MartijnPieters:)