Installed Nose but cannot use on command line

后端 未结 8 1307
南旧
南旧 2020-12-29 06:40

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
  Downlo         


        
相关标签:
8条回答
  • 2020-12-29 07:05

    From what I understand, everyone is moving to pytest - an actively-maintained testing framework.

    It's not a solution to this problem, but it's likely the most-appropriate choice if you are still using nose.

    0 讨论(0)
  • 2020-12-29 07:05

    This can also happen if you were running nose within a virtual environment, and that virtual environment has been deactivated. If this is the case, reactivate with source bin/activate.

    0 讨论(0)
  • 2020-12-29 07:15

    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
    
    0 讨论(0)
  • 2020-12-29 07:18

    First, can you run 'python' from the command line? nosetests should be in that same directory:

    rich bin $ which python
    /home/rich/anaconda/bin/python
    rich bin $ which nosetests
    /home/rich/anaconda/bin/nosetests
    

    It should also be in the downloaded nose package:

    rich bin $ find /home/rich/anaconda -name nosetests
    /home/rich/anaconda/pkgs/nose-1.3.3-py27_0/bin/nosetests
    /home/rich/anaconda/pkgs/nose-1.3.7-py27_0/bin/nosetests
    /home/rich/anaconda/bin/nosetests
    
    0 讨论(0)
  • 2020-12-29 07:20

    I found that going to

    Library/usr/bin 
    

    and running

    sudo easy_install nose
    

    it seems that sometimes it doesn't automatically install nose (and therefore nosetests functionality). Do the above lines, and you should be a-ok.

    I wish i had a better explanation for why this happened, but i'm still pretty new, myself.

    0 讨论(0)
  • 2020-12-29 07:24

    I try to reinstall the pip, it doesn't work but lastly, when i use sudo ...it works

    pip3 uninstall nose

    sudo pip3 install nose

    and

    which nosetests

    /usr/local/bin/nosetests

    0 讨论(0)
提交回复
热议问题