How can I see which sqlite3 binary does the sqlite3 Python module use on Ubuntu 16.04?

戏子无情 提交于 2020-03-05 01:31:32

问题


How can I see which sqlite3 binary (containing the SQLite relational database management system) does the sqlite3 Python module use on Ubuntu 16.04?

I unsuccessfully looked at /usr/lib/python3.7/sqlite3 and https://docs.python.org/3/library/sqlite3.html. I use Python 3.7.

The output of

python -c "import sqlite3; print(sqlite3.__file__)"

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


回答1:


It's not going to use the sqlite3 executable directly if that's what you're thinking. It's going to be linked to the sqlite3 dynamic library installed on your system. To find out which particularly library it's linked to, use ldd on the _sqlite3 python c extension. The _sqlite3 module is the underlying interface that the sqlite3 module relies on.

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


来源:https://stackoverflow.com/questions/60245354/how-can-i-see-which-sqlite3-binary-does-the-sqlite3-python-module-use-on-ubuntu

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!