Reputation: 2161
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?
Upvotes: 7
Views: 10273
Reputation: 102922
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.
Upvotes: 9
Reputation: 2161
These are the steps that I found to work. Thanks, for the parts contributed by MattDMo.
# use python3 to unstall pip3
sudo python3 get-pip.py
which python3
# ls -l on the result of which to find the target of the link
# Using the path to the target (directory), set up links to pip3, pip3.3
ls -l /Library/Frameworks/Python.framework/Versions/3.3/bin/
ln -s /Library/Frameworks/Python.framework/Versions/3.3/bin/pip3 /usr/local/bin/pip3
ln -s /Library/Frameworks/Python.framework/Versions/3.3/bin/pip3.3 /usr/local/bin/pip3.3
# install nose for python3
# and set a link to the installation
sudo pip3 install nose
ln -s /Library/Frameworks/Python.framework/Versions/3.3/bin/nosetests-3.3 /usr/local/bin/nosetests-3.3
Upvotes: 4