Installing nose using pip, but bash doesn't recognize command on mac

47,589

Solution 1

I got this problem until I setup nose with sudo:

sudo pip install nose

Solution 2

i had the same problem but this solved it.

  1. Install: nose2
  2. Then use: nose2 instead of nosetests to test program

Good Luck...!

Solution 3

I'm using OS X 10.11.1.

Do the following in the terminal:

  1. Move into directory ~/Python/2.7/site-packages/

  2. type sudo easy_install pip

  3. type sudo easy_install virtualenv

  4. type sudo easy_install nose

  5. type sudo easy_install distribute

  6. Follow the steps as instructed in the Learn Python The Hard Way book.

Solution 4

On OSX, using pip to install nose 1.3 installed nose to /usr/local/share/python/nosetests which isn't in the $PATH by default.

Solution 5

Sorry for resurrecting an old thread, but I just want to point out that no one has mentioned activating the virtual environment. People are asking "Are you in the virtual environment?" but user2778157 seems to be confused on exactly what that means. I would like to clarify this and think it may actually be the source of the problem. (Sorry for the pun on source).

When you use pip install, you aren't installing to your host's system, but into the virtual environment. When you create a virtual environment, it will have a folder bin with a file activate in it. In order to activate the virtual environment, you need to do source PATH/TO/ACTIVATE. While your virtual environment is activated, your system will check your virtual environment for the program before checking the host, and this is where your pip packages should be.

The reason you don't use sudo pip install is because this will get the super user (who doesn't have the environment activated) to install the package, which will go to your host.

Share:
47,589
Zubin
Author by

Zubin

Updated on July 29, 2020

Comments

  • Zubin
    Zubin almost 4 years

    I'm trying to install nose on my computer for the Learn Python the Hard Way tutorial, but can't seem to get it to work. I'm using pip to install:

    $ pip install nose
    

    And I get back:

    Requirement already satisfied (use --upgrade to upgrade): nose in /usr/local/lib/python2.7/site-packages
    Cleaning up...
    

    However, when I run the command nosetests, I get:

    -bash: nosetests: command not found
    

    I'm thinking there's something wrong with my PATH, but honestly I have no idea. Any help would be greatly appreciated!