巧乐之   客厅
22-06-03T23:06:02

linux sqlite升级试验

分享

.
在win11中安装python3.10以后,内嵌的sqlite可以支持元组匹配。类似如下语句:

sql = '''
select * from test_table where (fd1,fd2) in
(
    select fd1 , fd2
    where fd2 = 10
)  '''

其中的 (fd1, fd2) 作为元组来匹配

然而在很多linux机器上安装python3.10以后,直接执行上述sql会报错,不识别上述元组语句

.

分享 #77742 2022-06-03

.
在windows检查sqlite版本,是3.37.2
而linux上是3.7.17

估计问题在这里

于是研究如何升级
.

分享 #77764 2022-06-03

大图

分享 #77780 2022-06-03

参考文档

分享 #77802 2022-06-03

.
1、下载python3.10和sqlite3.38的安装包,上传到Linux服务器
2、将现有的sqlite3粗暴地移走(用root!) mv /usr/bin/sqlite3 /usr/bin/sqlite3_old
.

分享 #77799 2022-06-03

大图

分享 #77814 2022-06-03

3. tar -xzf sqlite.tar.gz
4. cd sqlite 
5. ./configure --prefix=/usr/local/sqlite3 # 出错,没有合适的编译器
6. yum install gcc 
7. ./configure --prefix=/usr/local/sqlite3
8. make # 出错,说没有tclsh

分享 #77820 2022-06-03

安装tclsh

分享 #77863 2022-06-03

10. cd tcl8.5.19/unix
11. ./configure --prefix=/usr/tcl
12. make 
13. make install 
14. ln -s /usr/tcl/bin/tclsh8.5 /usr/local/bin/tclsh

15. rm -rf sqlite/  # 再来
16. tar -xzf sqlite.tgz
17. cd sqlite 
18. ./configure --prefix=/usr/local/sqlite3
19. make 
20. make install 

21. ln -s /usr/local/sqlite3/bin/sqlite3 /usr/local/bin/sqlite3

分享 #77866 2022-06-03

大图

分享 #77882 2022-06-03

由于粗暴地改了名字,所以现在干脆连不上sqlite3
尝试安装python3

22. cd Python-3.10.4
23. ./configure --prefix=/wpc/python/python3.10
24. make 
25. make install # 由于sqlite 已经被删掉了,所以这里会有错误1,启动python3后, import sqlite3会出错

再来:

26. cd Python-3.10.4
27. LD_RUN_PATH=/usr/local/sqlite3/lib ./configure LDFLAGS="-L/usr/local/sqlite3/lib" CPPFLAGS="-I/usr/local/sqlite3/include"  --prefix=/wpc/python/python3.10
28. LD_RUN_PATH=/usr/local/sqlite3/lib make
29. make install # 还是不行

把粗暴改名的sqlite找回来,把新的sqlite3符号链接去掉后,再做,还是错误1,但是似乎可以用了

分享 #77886 2022-06-03

安装openssl1.1.1

分享 #77914 2022-06-03