自动化工具 jenkins 执行 python 脚本报:ImportError: No module named configparser

zll · 2017年04月17日 · 最后由 王小喜 回复于 2018年06月12日 · 1582 次阅读

jenkins 执行 python 脚本报:ImportError: No module named configparser

日志:
Started by user zllcjx
Building in workspace /Users/Shared/Jenkins/Home/workspace/接口测试
[接口测试] $ /bin/sh -xe /Users/Shared/Jenkins/tmp/hudson8711863975502678804.sh

  • python /Users/zll/interface_test/runtest.py Traceback (most recent call last): File "/Users/zll/interface_test/runtest.py", line 5, in import interface.weather File "/Users/zll/interface_test/interface/weather.py", line 7, in from globalpkg.httpprotocol import MyHttp File "/Users/zll/interface_test/globalpkg/httpprotocol.py", line 10, in from globalpkg.logs import logger File "/Users/zll/interface_test/globalpkg/logs.py", line 7, in import configparser ImportError: No module named configparser Build step 'Execute shell' marked build as failure Finished: FAILURE

我在本地执行 python 脚本是 ok 的
麻烦各位看看是什么问题啊?

共收到 2 条回复 时间 点赞

configparser 是 python3 的
你确定 jenkins 用的和你手动用的是同一个 python?

cd /Users/zll/interface_test;python runtest.py
这样设置就可以了

需要 登录 后方可回复, 如果你还没有账号请点击这里 注册