Reputation: 403
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!
Upvotes: 35
Views: 48494
Reputation: 681
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.
Upvotes: 2
Reputation: 2660
Setting PATH variable for 'nosetests' is required. Please use this one on your Terminal:
alias nosetests='/Library/Frameworks/Python.framework/Versions/2.7/bin/nosetests'
Good luck!
Upvotes: 1
Reputation: 1356
i had the same problem but this solved it.
Good Luck...!
Upvotes: 13
Reputation: 201
I'm using OS X 10.11.1.
Do the following in the terminal:
Move into directory ~/Python/2.7/site-packages/
type sudo easy_install pip
type sudo easy_install virtualenv
type sudo easy_install nose
type sudo easy_install distribute
Follow the steps as instructed in the Learn Python The Hard Way book.
Upvotes: 6
Reputation: 934
I know this is an old thread but just in case someone else needs it:
I'm using OS X 10.9.3. After installing all of the packages 'cd' into the project directory as instructed in the book. Then type
sudo nosetests
Then you'll see what the 'learnpythonthehardway' author shows in the book and online.
Upvotes: -2
Reputation: 681
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.
Upvotes: 2
Reputation: 14185
I got this problem until I setup nose with sudo
:
sudo pip install nose
Upvotes: 14
Reputation: 48649
However, when I run the command nosetests,
Of course, how you ran that command and from what directory might be important.
I'm thinking there's something wrong with my PATH, but honestly I have no idea.
If you do:
$ echo $PATH
...you will be able to see all the directories in your path. Of course, you can add any directory you want to your PATH.
However, I recently installed nose on my mac, and I installed by hand:
.../Downloads$ tar xfvz nose-1.3.0
.../Downlaods$ cd nose-1.3.0
.../nose-1.3.0$ sudo python setup.py install
...and nosetests installed here:
$ which nosetests
/Library/Frameworks/Python.framework/Versions/2.7/bin/nosetests
And there is a nose directory in my site-packages directory as per usual, as well. So on my mac, nosetests installed in a directory outside the site-packages directory. It's possible that only newer versions of nose install the nosetests command. You might want to try:
$ pip install --upgrade nose
Upvotes: 1
Reputation:
pigging backing off of 7stud, you could do sudo find / -name nosetests
and then append that to your PATH
(I'm sure that doing find
off of /
is a bit overkill, but I like that it goes over the entire OS)
Upvotes: 0