问题
I try to install scipy on my mac 10.6.8 but always have problem with it. I've installed ipython (sudo /usr/bin/easy_install-2.6 ipython
) and numpy (python setup.py build/install
), but when I installed scipy by the same way, I got always this error message:
RuntimeError: Running cythonize failed!
Could someone tell me how to solve this problem?
回答1:
Have you tried using the binaries provided for OSX? That should ensure everything works.
EDIT
The easiest way I've found to keep package dependencies under control is to use MacPorts as much as possible because unlike Homebrew, the packages are designed to work together and dependencies are (almost always) automagically installed when you try to install something.
So, first, install MacPorts using the installer for Snow Leopard. Choose the option to install ports in a unique directory like /opt/local
, so they don't conflict with whatever built-in versions the OS depends on. Also, ensure that /opt/local/bin
and /opt/local/sbin
are added to your $PATH
before the system directories like /usr/bin
, /bin
, /sbin
etc. so that when you run python
from the command prompt you get the version you want. Your ~/.profile
should have something like export PATH="/opt/local/bin:/opt/local/sbin:$PATH
as its last line.
After MacPorts has been installed, you may want to restart just for fun to ensure that all of your environment variable are set up properly. Start Terminal.app (or your favorite replacement) and enter which port
, which should return /opt/local/bin/port
if everything worked correctly. Next, run sudo port selfupdate
just to make sure everything is synced properly. Once that is done, we can install python and some modules. port
allows you to pass a list of ports to be installed, so a command like sudo port install foo bar baz
will install the latest versions of the foo
, bar
, and baz
ports, along with any dependencies they may require, in the correct order. Some ports have binary distributions, and others are compiled as needed, so the first time you run it there may be a lot of dependencies to install. A nice feature of MacPorts is that you can have multiple versions of some packages installed at the same time, and you can switch between them if needed. Also, if port search
is giving too many results, the online search engine can help you find what you're looking for.
To get a decent IPython-based Python 2 development environment going, you'll need the following:
python27
py27-ipython
py27-numpy
py27-scipy
py27-matplotlib
(if you like drawing pretty pictures, but mainly so you can getpylab
)py27-pandas
(DataFrame
s are your friend!)- and perhaps
py27-pyqt4
if you run ipython via theqtconsole
option
I'd also install py-pip
and py27-distribute
so you can install modules on your own if there is no MacPort version.
Finally, if you're a forward-looking person and want to use numpy
et al. on Python 3, MacPorts has you covered! There are py32
- and py33
-based versions of all of the above packages except scipy
, which is only py32
for now. However, I was able to install it just fine with pip
, although I have a whole bunch of other devel tools on my machine, and I'm running 10.8.2, so YMMV.
Good luck!
来源:https://stackoverflow.com/questions/15449467/installing-scipy-on-mac-10-6-8