Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I install nose on a Mac for python 3

I used easy_install to install nose on my Mac (OS Mavericks). It works fine with the default python 2.7 installation.

If I run nosetests on a module using python 3, it fails to find the imports. What do I need to know and do, to use nose for python 3 as well?

like image 271
Fred Mitchell Avatar asked Jan 22 '14 22:01

Fred Mitchell


1 Answers

The best way to handle installation (and removal) of third-party packages is to use pip. First, download get-pip.py and save it someplace. Navigate to that folder in Terminal and enter

sudo python3 get-pip.py

to install it for Python 3. I'd recommend running

sudo python get-pip.py

as well to install it for Python 2, as easy_install is deprecated.

Once you have pip installed, you should have access to pip3 or pip-3.3 - check the installation directory to see exactly which scripts were installed. Assuming you have the command pip3, you can now run

sudo pip3 install nose

and it will install nose and any dependencies in your Python 3 site-packages folder, as well as a nosetests executable in your Python installation's bin folder.

like image 136
MattDMo Avatar answered Oct 17 '22 08:10

MattDMo