Mac: Error importing scikits while it has been installed
I installed the scikits package but can't import it, I am on Macbook, please let me know what is missing here
bash-3.2$ sudo port install py26-scikits-learn
---> Computing dependencies for py26-scikits-learn
---> Fetching archive for py26-scikits-learn
---> Attempting to fe开发者_开发技巧tch py26-scikits-learn-0.8_0.darwin_10.x86_64.tbz2 from http://packages.macports.org/py26-scikits-learn
---> Fetching py26-scikits-learn
---> Verifying checksum(s) for py26-scikits-learn
---> Extracting py26-scikits-learn
---> Configuring py26-scikits-learn
---> Building py26-scikits-learn
---> Staging py26-scikits-learn into destroot
---> Installing py26-scikits-learn @0.8_0
---> Activating py26-scikits-learn @0.8_0
---> Cleaning py26-scikits-learn
bash-3.2$ python -c "import scikits.learn as skl; skl.test()"
Traceback (most recent call last):
File "<string>", line 1, in <module>
ImportError: No module named scikits.learn
FIXED How do I uninstall python from OSX Leopard so that I can use the MacPorts version?
Unfortunately I don't know how port commnad works (I guess it comes from MacPorts) but you should use Python to maintain Python packages (which is encouraged eg. by homebrew). You can try pip:
sudo pip install scikits.learn
In OS X Lion default version of Python is 2.7, if you want to use 2.6 you have to:
sudo python2.6 pip install scikits.learn
(Python keeps separate packages for every version)
You can browse all packages available via pip (or easy_install) using pypi or search it with
pip searh foo
If you are afraid of cluttering you system please give a try virtualenvwrapper.
精彩评论