我正在嘗試設置一個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來使它正常工作。 –