简体   繁体   中英

'nosetests' not recognized on Windows after being installed and added to PATH

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 .

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

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. 看这里

You can also use python -m nose in PowerShell.

This worked for me in Windows 7, 32 bit.

在此输入图像描述

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.

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