Max*_*wer 5 python linux sqlite conda
我想检查我拥有哪个版本的 sqlite,这变得比我预期的更令人困惑。为了重新开始,我创建了一个新的 conda 环境:
conda create --name my_env_name python=3.6 sqlite hdf5 pandas
Run Code Online (Sandbox Code Playgroud)
shell 消息说它将安装sqlite: 3.13.0-1在新环境中,以及一些其他软件包。
然后,在激活新的 conda 环境后,我立即运行了pip freeze,但我看到的包列表不包含sqlite.
最后,我只是python从终端输入(在这个 conda env 中)在我的 shell 中输入一个系统 python。开始消息说 python 版本 3.6.1,确认我在那个新创建的环境中。但是之后
import sqlite3
sqlite3.version
Run Code Online (Sandbox Code Playgroud)
产出 '2.6.0'
这是怎么回事?我是否安装了 sqlite3 版本 3.13 或 2.6?如果我的 sqlite3 版本是 2.6,我如何获得更新的东西?那会很旧。
是的,您已经安装了sqlite: 3.13.0-1sqlite数据库版本。如果你想检查,运行sqlite3 --version
import sqlite3
sqlite3.version
Run Code Online (Sandbox Code Playgroud)
在这里,您可以获得 SQLite 的 DB-API 2.0 接口版本,它是 2.6.0
将 sqlite3 导入您的 Python 脚本:
import sqlite3
Run Code Online (Sandbox Code Playgroud)将以下行添加到您的脚本中:
print "SQLite Version is:", sqlite3.sqlite_version
print "DB-API Version is:", sqlite3.version
Run Code Online (Sandbox Code Playgroud)运行脚本为我生成了以下结果(您的结果可能会有所不同):
SQLite Version is: 3.11.0
DB-API Version is: 2.6.0
Run Code Online (Sandbox Code Playgroud)此信息记录在 Python 标准库,“第 12.6.1 节。模块函数和常量” https://docs.python.org/3/library/sqlite3.html