Jenkins搭建完成之后,我们可以把已经写好的Python代码部署到Jenkins平台上执行。执行的时候都在服务器上运行的。所以服务器上需要安装 git python。
安装git
默认Linux上没有git 环境。
yum install -y git
安装配置Python
下载Python Linux 源码
官网:https://www.python.org/downloads/source/
下载完成之后,将源码上传至服务器。
解压文件
tar -xf Python-3.10.2.tgz
配置python
cd Python-3.10.2/
./configure
安装python
配置完成之后对python进行安装
make && make install
对python的源码进行自动的编译安装。
检查Python版本
因为在Linux平台默认安装有的 python2.7 的版本,不能卸载。安装的Python3版本。使用的时候需要使用命令 python3
python3 --version
安装pytest,requests
等下在服务器上运行我们写好的Python代码,但是我们写的代码中有使用到pytest,requests,
pip3 install pytest
pip3 install requests