“no suitable image found” error when using numpy

孤街浪徒 提交于 2020-01-06 20:52:52

问题


I tried to use NumPy in Terminal, but the system gave me an error message like this:

Traceback (most recent call last): File "", line 1, in File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/numpy/init.py", line 137, in import add_newdocs File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/numpy/add_newdocs.py", line 9, in from numpy.lib import add_newdoc File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/numpy/lib/init.py", line 4, in from type_check import * File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/numpy/lib/type_check.py", line 8, in import numpy.core.numeric as _nx File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/numpy/core/init.py", line 5, in import multiarray

ImportError: dlopen(/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/numpy/core/multiarray.so, 2): no suitable image found. Did find: /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/numpy/core/multiarray.so: no matching architecture in universal wrapper

How can I fix it? I installed Python 2.7.3 from official source and my machine is running OSX 10.7.4.


回答1:


Your installation of NumPy is borked somehow: it detects that some of its core libraries (eg, multiarray.so) were compiled with a different version of the compiler or for a different architecture.

If you installed NumPy before updating your Python to 2.7.3, you have to reinstall it. You could find precompiled binaries, but as you've modified the original Python, they may not work for you.

At the same time, compiling NumPy on Mac OS X isn't particularly difficult. There are some environment variables to set beforehand, but otherwise, it's a straightforward process. This link should give you precious information.



来源:https://stackoverflow.com/questions/12629644/no-suitable-image-found-error-when-using-numpy

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!