I am learning Python using Zed Shaw's "Learn Python the Hard Way" on Windows using PowerShell. I am in Exercise 46 where you set up a skelton project. I downloaded pip, distribute, nose, and virtualenv and I installed them by typing:
python <filename>.py install
However, probably because they were not installed where they were supposed to, when I try
nosetests
I get errors saying "The term 'nosetests' is not recognized as the name of a cmdelt, function, script file, or operable program. Check the spelling of the mae, or if a path was included, verify that the path is correct and try again.... CommandNotFoundException".
I have been going through the exercises fine, so I thought that the path was correct but do you have to change it now? Right now, I have the packages under the directory where I have my skelton (..project/skelton). I am sorry for a real-beginner question but if anybody could help me with this, I highly appreciate it!!
I had the same error but the answer was in the book. Type this into powershell, hope it works for you too.
[Environment]::SetEnvironmentVariable("Path", "$env:Path;C:\Python27", "User")
Try this:
// make sure you have pip and virtualenv installed
cd project
// create a virtual environment
virtualenv venv --distribute
// activate the virtual environment
// I'm not 100% sure, but I think this is correct way on windows
venv\Scripts\activate.bat
// install nose
pip install nose
You should now be able to run nosetests as long as your virtualenv is activated.
Maybe this is late for your question, but this may help others that will experience the same issue that we've experienced. I've got mine working doing the ff. steps:
(Assuming that you've downloaded all packages as discussed in the book):
- pip from https://bootstrap.pypa.io/get-pip.py (save that as python file)
- distribute from http://pypi.python.org/pypi/distribute
- nose from http://pypi.python.org/pypi/nose/
- virtualenv from http://pypi.python.org/pypi/virtualenv
Follow this to install all:
- Run Windows Powershell as Administrator
- cd C:\Path_Where_You_Downloaded_get-pip.py
- Install pip by using the command 'python get-pip.py'
- Run Command Prompt as Administrator
- cd to location of Python27 scripts (in my case C:\Python27\Scripts)
- Try to update pip using the command 'pip install --upgrade pip'
- Install Nose by using this command 'pip install C:\Path_Where_You_downloaded_nose'
- Install distribute using command 'pip install distribute'
Hope this helps!