我正在尝试设置一个jenkins作业来运行我的lint.py
文件。我运行詹金斯命令是:与jenkins运行pylinter
pip install -r requirements.txt
python lint.py
而且我看到的输出是:
Requirement already satisfied (use --upgrade to upgrade): pylint in /var/lib/jenkins/.local/lib/python2.7/site-packages (from -r requirements.txt (line 1))
Requirement already satisfied (use --upgrade to upgrade): sqlalchemy in /var/lib/jenkins/.local/lib/python2.7/site-packages (from -r requirements.txt (line 2))
Requirement already satisfied (use --upgrade to upgrade): pandas in /var/lib/jenkins/.local/lib/python2.7/site-packages (from -r requirements.txt (line 3))
Requirement already satisfied (use --upgrade to upgrade): python-dateutil in /usr/local/lib/python2.7/dist-packages (from pandas->-r requirements.txt (line 3))
Requirement already satisfied (use --upgrade to upgrade): pytz>=2011k in /var/lib/jenkins/.local/lib/python2.7/site-packages (from pandas->-r requirements.txt (line 3))
Requirement already satisfied (use --upgrade to upgrade): numpy>=1.7.0 in /var/lib/jenkins/.local/lib/python2.7/site-packages (from pandas->-r requirements.txt (line 3))
Cleaning up...
+ python lint.py
sh: 1: pylint: not found
sh: 1: pylint: not found
sh: 1: pylint: not found
sh: 1: pylint: not found
sh: 1: pylint: not found
sh: 1: pylint: not found
sh: 1: pylint: not found
sh: 1: pylint: not found
sh: 1: pylint: not found
sh: 1: pylint: not found
sh: 1: pylint: not found
sh: 1: pylint: not found
['lint.py']
no directory specified, defaulting to current working directory
此时作业失败。
因此:该包已安装,但运行lint.py
时未找到该包。
当我手动这样做时,我可以sudo pip install pylint
和lint.py
会愉快地运行,但这不是jenkins工作的选项。另外,我相信,这应该能够没有sudo
工作,因为包是安装somwhere。我曾尝试将PYTHONPATH="/var/lib/jenkins/.local/lib/python2.7/site-packages" python lint.py
添加到命令中,但我得到了相同的结果。
有谁知道我能做些什么来使lint.py
运行?谢谢。
你可以尝试在详细模式下为用户詹金斯(须藤-u詹金斯蟒蛇-v)运行Python和看到它看起来为pylint?如果它找到它,你可以弄清楚如何操作你的pythonpath来使它正常工作。 –