'nosetests' not recognized on Windows afte

2019-03-20 08:45发布

I'm on exercise 46 of Learn Python the Hard Way, and I'm meant to install nose and run nosetests. I've installed nose already using pip, but when I run nosetests in the directory above the 'tests' folder, I get the error:

'nosetests' is not recognized as an internal or external command, operable program or batch file.

If it's relevant, I've already modified the PATH variable to include full path of Python27/Scripts and Python/Lib/site-package.

4条回答
SAY GOODBYE
2楼-- · 2019-03-20 08:56

I use Windows and I had the same problem.The LPTHW book is based on Linux OS and it's a bit difficult for windows users. When I typed nosetests, I got errors. Then I typed python -m nose , as per said by Spellstaker and it worked perfectly. I have noticed that in most cases we need to add 'python -m' at the beginning to make it work on Windows. See here

查看更多
爷的心禁止访问
3楼-- · 2019-03-20 09:02

If you are still having trouble after following Warren Weckesser's instructions try uninstalling and reinstalling.

Using pip: pip uninstall nose

I found this worked for me on Windows 8 64 bit

查看更多
老娘就宠你
4楼-- · 2019-03-20 09:03

You can also use python -m nose in PowerShell.

This worked for me in Windows 7, 32 bit.

查看更多
Evening l夕情丶
5楼-- · 2019-03-20 09:03

enter image description here

Command: python -m nose or py -m nose

Remember you should stay in the current virtual environment to run the nose if it is installed locally. Check the local environment name lpthw in the PowerShell after you activate the same.

查看更多
登录 后发表回答