简体   繁体   中英

How do I install scipy, numpy and scikit-learn on snow leopard?

I have been trying to install scipy, numpy and scikit-learn on snow leopard with python 2.7 but without success so far.

All I can find is for Lion which I can't upgrade to. I successfully installed python 2.7, pip, virtualenv, virtualenvwrapper and numpy. But when I tried to install scipy I got this error.

/var/folders/KU/KUY52WxPExK-Pljd3M-eV++++TM/-Tmp-//cc3jPxg5.s:3149:junk `@GOTPCREL' after expression

/var/folders/KU/KUY52WxPExK-Pljd3M-eV++++TM/-Tmp-//cc3jPxg5.s:3149:`___dso_handle@GOTPCREL(%rip)' is not a valid base/index expression

/var/folders/KU/KUY52WxPExK-Pljd3M-eV++++TM/-Tmp-//cc3jPxg5.s:3150:`__ZStL8__ioinit(%rip)' is not a valid base/index expression

/var/folders/KU/KUY52WxPExK-Pljd3M-eV++++TM/-Tmp-//cc3jPxg5.s:3151:junk `@GOTPCREL' after expression

/var/folders/KU/KUY52WxPExK-Pljd3M-eV++++TM/-Tmp-//cc3jPxg5.s:3151:`__ZNSt8ios_base4InitD1Ev@GOTPCREL(%rip)' is not a valid base/index expression

/var/folders/KU/KUY52WxPExK-Pljd3M-eV++++TM/-Tmp-//cc3jPxg5.s:3155:bad register name `%rsp'


error: Command "c++ -fno-strict-aliasing -fno-common -dynamic -isysroot /Developer/SDKs/MacOSX10.6.sdk -arch i386 -arch x86_64 -g -O2 -DNDEBUG -g -O3 -Iscipy/interpolate/src -I/Users/user/.virtualenvs/venv/lib/python2.7/site-packages/numpy/core/include -I/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c scipy/interpolate/src/_interpolate.cpp -o build/temp.macosx-10.6-intel-2.7/scipy/interpolate/src/_interpolate.o" failed with exit status 1

I have gcc and g++ 4.2 installed and I think I have found out that it should be for gcc, g++ 4.0 which I don't know how to install.

What should I do to successfully intall scipy, numpy and scikit-learn on Snow Leopard?

Thanks very much.

EDIT: I use brew install python to install python 2.7.3 and I have Xcode 4.2 installed on my snow leopard. And the above is the error I got when I was trying to install scipy.

And when I look into my /usr/bin I only have g++, g++-4.2

g++ is also version 4.2.1

I only have Xcode 4.2 installed too, but managed to found a gcc-4.0 on my system that worked. Not sure how it got there, but I suppose it came with Xcode 4.2.

So, before installing an older version of Xcode you may want to check if you have a gcc-4.0 in this location:

/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/

All I did was to run this:

export CC=/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc-4.0
export CXX=/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/g++-4.0
export ARCHFLAGS='-arch i386 -arch x86_64'

... before installing scipy:

pip install scipy

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM