简体   繁体   中英

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:

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.

sudo clears the environment. You have to invoke the virtualenv inside of the sudo execution environment. 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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