Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Installed Nose but cannot use on command line

I installed Nose on a Mac OSX 10.10.5 with Python2.7.9 using easy_install. The installation appeared to be successful:

Collecting nose
  Downloading nose-1.3.7-py2-none-any.whl (154kB)
    100% |████████████████████████████████| 155kB 2.3MB/s 
Installing collected packages: nose
Successfully installed nose-1.3.7

But now, when I try even basic stuff with nosetests on the command line, like nosetests -h or which nosetests I just get:

bash: nosetests: command not found

I have tried uninstalling, reinstalling using pip, tried installing with sudo and then running sudo nostests in the directories with tests scripts as other posts have suggested, but nothing seems to work.

The original purpose for installing was to use nose to run some basic tests with tests scripts I had written for these simple web.py apps. But nothing works, just keep getting the command not found response.

What's strange is that, when I open up the Python interpreter in Terminal, and do something like:

import nose 
nose.main()

I get the expected result of:

.
----------------------------------------------------------------------
Ran 1 test in 0.135s

OK

So clearly it's installed....somewhere. Any suggestions for what the hell is going on here?

like image 410
AdjunctProfessorFalcon Avatar asked Sep 13 '15 04:09

AdjunctProfessorFalcon


Video Answer


2 Answers

There are lots of error occurred when using pip install packages on Mac OS. So I recommend you install nose using easy_install.

$ pip uninstall nose

$ sudo easy_install nose

Then you can try nosetests now :)

like image 51
yolanda.ly Avatar answered Oct 19 '22 01:10

yolanda.ly


I had this exact issue on OS X EI Captain with Python 2.7.10.

First I installed nose using pip:

$sudo pip install nose 

which failed on the first attempt. Went through on the second attempt. But the nosetests command didn't work.

In order to fix this:

Step 1: Don't uninstall nose if it was installed already using pip as in my case.

Step 2:

$cd /usr/bin

$sudo easy_install nose 

Above command finds the nosetests script (which was installed by pip earlier) & sets it under /usr/local/bin

Step 3: Try nosetests

$nosetests

----------------------------------------------------------------------
Ran 0 tests in 0.047s

OK
like image 35
Razikh Avatar answered Oct 19 '22 02:10

Razikh