如何查看 sqlite3 Python 模块在 Ubuntu 16.04 上使用哪个 sqlite3 二进制文件?

Fra*_*urt 0 python sqlite ubuntu

如何查看 Python 模块在 Ubuntu 16.04 上使用哪个sqlite3二进制文件(包含 SQLite 关系数据库管理系统)sqlite3

我没有成功查看/usr/lib/python3.7/sqlite3https://docs.python.org/3/library/sqlite3.html 。我使用Python 3.7。

的输出

python -c "import sqlite3; print(sqlite3.__file__)"
Run Code Online (Sandbox Code Playgroud)

/usr/lib/python3.7/sqlite3/__init__.py

clo*_*her 7

如果您这么想的话,它不会直接使用 sqlite3 可执行文件。它将链接到系统上安装的 sqlite3 动态库。要找出它链接到的特定库,请在 _sqlite3 python c 扩展上使用 ldd。_sqlite3模块是sqlite3模块依赖的底层接口。

$ ldd `查找 /usr/lib/python3.7/ -name '_sqlite3*'` | grep sqlite
    libsqlite3.so.0 => /usr/lib/x86_64-linux-gnu/libsqlite3.so.0 (0x00007f47705a2000)