python-3.x - 为什么我的 jenkins 服务器上不同用户的 sqlite 版本不同?
问题描述
作为詹金斯用户,我sqlite_version
是3.7.17
bash-4.2$ python3.8
Python 3.8.2 (default, May 8 2020, 12:44:28)
[GCC 4.8.5 20150623 (Red Hat 4.8.5-39)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import sqlite3
>>> sqlite3.sqlite_version
'3.7.17'
sqlite_version
作为我的根用户3.31.1
[root@jenkins ~]# python3.8
Python 3.8.2 (default, May 8 2020, 12:44:28)
[GCC 4.8.5 20150623 (Red Hat 4.8.5-39)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import sqlite3
>>> sqlite3.sqlite_version
'3.31.1'
他们都使用相同的python二进制文件
[root@jenkins ~]# which python3.8
/usr/local/bin/python3.8
bash-4.2$ which python3.8
/usr/local/bin/python3.8
从源代码安装新的 sqlite3 后我采取的步骤:
- 删除了旧版本的
sqlite3
in/bin
- 我添加
/usr/local/bin
到jenkins
路径中/var/lib/jenkins/.bashrc
你知道如何让 jenkins python 使用新的 sqlite3 版本吗?
更新:
运行sqlite3.__file__
:
詹金斯
>>> sqlite3.__file__
'/usr/local/lib/python3.8/sqlite3/__init__.py'
根
>>> sqlite3.__file__
'/usr/local/lib/python3.8/sqlite3/__init__.py'
解决方案
以下适用于 CentOS 7.7:
安装 Python 依赖项:
sudo yum -y groupinstall 'Development Tools'
sudo yum -y install openssl-devel bzip2-devel libffi-devel
SQLite 源安装:
wget https://sqlite.org/2020/sqlite-autoconf-3310100.tar.gz
tar -xf sqlite-autoconf-3310100.tar.gz
cd sqlite-autoconf-3310100/
./configure
make
sudo make install
Python源安装:
wget https://www.python.org/ftp/python/3.8.2/Python-3.8.2.tar.xz
tar -xf Python-3.8.2.tar.xz
cd Python-3.8.2/
sudo LD_RUN_PATH=/usr/local/lib ./configure --enable-optimizations
sudo LD_RUN_PATH=/usr/local/lib make altinstall
测试:
[centos@jenkins ~]$ sudo su
[root@jenkins centos]# id
uid=0(root) gid=0(root) groups=0(root) context=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023
[root@jenkins centos]# grep PATH /root/.bashrc
export PATH=$PATH:/usr/local/bin
[root@jenkins centos]# python3.8
Python 3.8.2 (default, May 15 2020, 07:26:39)
[GCC 4.8.5 20150623 (Red Hat 4.8.5-39)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import sqlite3
>>> sqlite3.sqlite_version
'3.31.1'
>>> sqlite3.__file__
'/usr/local/lib/python3.8/sqlite3/__init__.py'
>>>
[root@jenkins centos]# exit
[centos@jenkins ~]$
[centos@jenkins ~]$ sudo su - jenkins
Last login: Fri May 15 07:44:53 UTC 2020 on pts/0
-bash-4.2$ id
uid=996(jenkins) gid=993(jenkins) groups=993(jenkins) context=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023
-bash-4.2$ pwd
/var/lib/jenkins
-bash-4.2$ grep PATH .bashrc
grep: .bashrc: No such file or directory
-bash-4.2$ python3.8
Python 3.8.2 (default, May 15 2020, 07:26:39)
[GCC 4.8.5 20150623 (Red Hat 4.8.5-39)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import sqlite3
>>> sqlite3.sqlite_version
'3.31.1'
>>> sqlite3.__file__
'/usr/local/lib/python3.8/sqlite3/__init__.py'
>>>
推荐阅读
- powershell - 无法使用空组捕获工作站详细信息
- flutter - 检测设备是否会在 Flutter 中显示软键盘
- reactjs - 反应打字稿和孩子
- git - 为了防止性能问题,省略了 82 个额外的提交。GitLab
- firebase - Firebase OnDisconnect 事件
- r - R:我的数据框有 1 列和多行,有没有办法计算某些行子集的平均值?
- python - 在机器学习 python 中使用模型进行预测
- sql - 通过连接视图和表实现物化视图
- cpu - 我的 CPU 真的与 Genymotion 不兼容吗?
- c - sk_buff / net_device:最小数据包大小?