简体   繁体   English

尝试运行命令“ sudo tox”时出现Tox调用错误

[英]Tox Invocation Error while trying to run command 'sudo tox'

While working in an virtualenv [3.4] I was trying to run tox for running the tests when I got the error: 在virtualenv [3.4]中工作时,出现错误时,我试图运行tox来运行测试:

py34 develop-inst-nodeps: /home/horcrux/dir-sub/dir
py34 runtests: commands[0] | python -m nose2 -v
/home/horcrux/dir-sub/dir/.tox/py34/bin/python: No module named nose2
ERROR: InvocationError: '/home/horcrux/dir-sub/dir/.tox/py34/bin/python -m nose2 -v'
_____________________________ summary ______________________________________
ERROR:   py34: commands failed

I've already tried to install nose2 using pip install nose2 but still the problem remains the same. 我已经尝试使用pip install鼻子2安装鼻子2,但是问题仍然相同。

sudo clears the environment. sudo清除环境。 You have to invoke the virtualenv inside of the sudo execution environment. 您必须在sudo执行环境中调用virtualenv。 Try: 尝试:

sudo bash -c ". [venv/bin/activate] ; [tox]"

Replace [venv/bin/activate] with the path to your virtualenv activate script and replace [tox] with whatever command you are using to invoke it. [venv/bin/activate]替换为virtualenv激活脚本的路径,并将[tox]替换为用于调用它的任何命令。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM