当前位置: 首页 > Linux

在jenkins中使用shell引用环境变量的方法

时间:2023-04-06 20:23:55 Linux

问题:使用jenkins执行python脚本时,报错:ImportError:Nomodulenamed***原因是jenkins没有加载PYTHONPATH环境变量。解决方法在要执行的脚本前添加如下脚本:#!/bin/sh+x。/etc/profileBPFile="$HOME/.bash_profile"PFile="$HOME/.profile"exeFile=""if[-f"$PFile"];thenexeFile=".$PFile"elif[-f"$BPFile"];thenexeFile=".$BPFile"fi$exeFileset-e原因:原因参考两篇博客:ZT:http://www.lilihongblog.com/B...https://blog.csdn.net/zzusimo...