返回错误“OSError:没有这样的文件或目录”。我们试图使用带有 shellCommand 的构建器中的步骤来激活我们新创建的虚拟环境 venvCI。似乎我们无法激活 virtualenv venvCI。我们在这个环境中只是新手,所以请帮助我们。谢谢。
from buildbot.steps.shell import ShellCommand
factory = util.BuildFactory()
# STEPS for example-slave:
factory.addStep(ShellCommand(command=['virtualenv', 'venvCI']))
factory.addStep(ShellCommand(command=['source', 'venvCI/bin/activate']))
factory.addStep(ShellCommand(command=['pip', 'install', '-r','development.pip']))
factory.addStep(ShellCommand(command=['pyflakes', 'calculator.py']))
factory.addStep(ShellCommand(command=['python', 'test.py']))
c['builders'] = []
c['builders'].append(
util.BuilderConfig(name="runtests",
slavenames=["example-slave"],
factory=factory))
由于构建系统为每个 ShellCommand 创建了一个新的 Shell,因此您不能 source env/bin/activate
因为这只会修改事件 shell 的环境。当 Shell(Command) 退出时,环境就消失了。
你可以做的事情:
例如
我的脚本.sh:
#!/bin/bash
source env/bin/activate
pip install x
python y.py
构建机器人:
factory.addStep(ShellCommand(command=['bash', 'myscript.sh']))
blog post about the issue
我是一名优秀的程序员,十分优秀!