[英]Problem upgrading Sqlite3 version on CentOS for Python
我的系統上有CentOS 6
,我正在嘗試為 Python 更新 SQLite。 我已經從源代碼安裝它並執行sqlite --version
按預期返回版本3.33.0
。
但是,當我嘗試使用import sqlite3; sqlite3.sqlite_version;
檢查 python SQLite 版本時import sqlite3; sqlite3.sqlite_version;
import sqlite3; sqlite3.sqlite_version;
我仍然得到以前的 SQLite 版本3.6.20
。
Software Locations:
Python 3.6.9 - /usr/bin/python3
Sqlite3 - /usr/bin/sqlite3
我在這里嘗試了解決方案,這根本不起作用,在更新LD_LIBRARY_PATH
並檢查 python SQLite 版本后它仍然給出“3.6.20”, 在這里,當我嘗試sudo LD_RUN_PATH=
,它給了我錯誤No such file or directory
,但是當我在沒有 sudo LD_RUN_PATH=
情況下執行它時,它成功編譯但仍然給我 SQLite '3.6.20'(編譯 python 而不卸載)。
注意:我有多個 python3 版本。
我能做些什么來解決這個問題?
當我這樣做時(特別是試圖找到一種方法來更新正在運行的 python 程序的 sqlite3;沒有工作......),我編譯了 sqlite 並得到了 libsqlite3.so.0.8.6,然后將系統范圍的 sqlite3 替換為那。 對於我在 debian 上,那是在 /usr/lib/x86_64-linux-gnu 中。 我確實看到(雖然現在我找不到在哪里)這種方式可能會導致將來更新時出現問題。 不過,它確實為我更新了 python 的 sqlite3。
您可以導入特定版本:
__requires__= 'sqlite3==3.6.20'
import pkg_resources
pkg_resources.require("sqlite3==3.6.20")
import sqlite
請注意,這僅適用於第一次導入。 如果在 pkg_resources 之前導入 sqlite,它將采用最新版本。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.