如何查看 Ubuntu 16.04 上的 sqlite3 Python 模块使用哪个 sqlite3 二进制文件? [英] How can I see which sqlite3 binary does the sqlite3 Python module use on Ubuntu 16.04?

查看:30
本文介绍了如何查看 Ubuntu 16.04 上的 sqlite3 Python 模块使用哪个 sqlite3 二进制文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

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

的输出

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

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

解决方案

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

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

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

解决方案

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)

这篇关于如何查看 Ubuntu 16.04 上的 sqlite3 Python 模块使用哪个 sqlite3 二进制文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆