我正在尝试设置一个jenkins作业来运行我的lint.py文件。我正在运行的jenkins命令是:
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的情况下工作,因为包是在某些地方安装的。我尝试将PYTHONPATH="/var/lib/jenkins/.local/lib/python2.7/site-packages" python lint.py添加到命令中,但得到了相同的结果。
有人知道我能做些什么来使lint.py运行吗?谢谢。
发布于 2015-07-20 21:16:41
看上去没有安装。你在运行什么操作系统?如果Debian或Ubuntu:
sudo apt-get install pylint如果这不起作用,那么验证您正在使用的python安装程序就是您所期望的设置。
which python
which pip
pip freeze或者,下面的插件可能对您有用:
https://stackoverflow.com/questions/31525063
复制相似问题