“不兼容的体系结构(具有ARM64',需要X86_64;)&quot在使用PIP3上安装Numpy在Python版本3.10上的M1 Mac上安装Numpy时错误
我试图在带有pip3的M1 MacBook上安装Numpy版本1.22.3,而PIP3表示包裹存在,但是当我尝试导入模块时,错误就会向我丢下错误,说导入numpy c extensions失败。
可能发生此错误
,这通常是由于您的设置问题或Numpy是
安装的。
。 错误的全文是:
dlopen(/library/frameworks/python.framework/versions/3.10/lib/python3.10/site-packages/numpy/core/_multiarray_umath.cpython-cpython--
310-DARWIN.SOSO,0x0002 ):试验:'/library/frameworks/python.framework/versions/3.10/lib/python3.10/site-packages/numpy/core/_multiarray_umath.cpy
thon-310-310-darwin.so'so'so'' (mach-o文件,但是一个不兼容的架构(具有'arm64',需要'x86_64'),'/usr/lib/_multiarray_umath.cpython-310-da
rwin.so'(否)这样的文件)
我遵循链接到“ noreferrer”>故障排除文档
我已经尝试重新安装Pip3和Python,但这也不起作用。
有什么想法吗?
I was trying to install numpy version 1.22.3 on a M1 Macbook with pip3, and pip3 says the package is present, but when I try to import the module, an error gets thrown at me that saysImporting the numpy C-extensions failed. This error can happen for
many reasons, often due to issues with your setup or how NumPy was
installed.
The full text of the error is:dlopen(/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/numpy/core/_multiarray_umath.cpython-
310-darwin.so, 0x0002): tried: '/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/numpy/core/_multiarray_umath.cpy
thon-310-darwin.so' (mach-o file, but is an incompatible architecture (have 'arm64', need 'x86_64')), '/usr/lib/_multiarray_umath.cpython-310-da
rwin.so' (no such file)
I followed the link to the troubleshooting documentation provided, and none of the solutions worked.
I've tried reinstalling both pip3 and Python, and that didn't work either.
Any ideas?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(6)
如果以上都不适合您,请在删除后尝试这种安装numpy
pip卸载numpy
arm64安装
Arch -arm64 pip安装numpy
x86_64安装
Arch -x86_64 pip安装numpy
,或者您可以在您的中保留一个alise bash配置文件:
If none of above worked for you try this way of install numpy after remove it
pip uninstall numpy
arm64 installation
arch -arm64 pip install numpy
x86_64 installation
arch -x86_64 pip install numpy
or you can keep an alise for that in your bash config file:
我能够通过在虚拟环境中卸载和重新安装numpy来解决此问题。
I was able to fix this issue by uninstalling and reinstalling numpy in my virtual environment.
我有同样的问题。对我有用的是将 python 版本从 3.10 降级到 3.8,然后重新安装 numpy。
I had the same issue. What worked for me was to downgrade the python version from 3.10 to 3.8 and then reinstall numpy.
我遇到了这个问题,对我有用的是,在我的Python Project目录中删除了我的
.venv
文件夹,并重新制作诗歌环境I had this issue, what worked for me was, deleting my
.venv
folder in my python project directory, and remaking the poetry environment要添加到 A. Sharif 的答案,可能需要在重新安装之前清除 pip 缓存(我在其他库(例如 openCV 或 sounddevice)中遇到过同样的问题,这解决了它)。在这种情况下,应遵循以下步骤:
卸载 Numpy
清除 pip 缓存
安装 numpy arm64
或者,在大多数情况下,正常安装将工作
这应该可以解决问题!下载 numpy 时,清除 pip 缓存将强制 pip 从头开始。下载可能需要更多时间,但它应该有助于安装正确的架构。
To add to A. Sharif's answer, it might be necessary to purge your pip caches before reinstalling (I have run in the same problem for other libraries such as openCV or sounddevice, and this solved it). In that case, the following steps should be followed:
Uninstall Numpy
Purge pip caches
Install numpy arm64
or, in most cases, a normal installation will work
This should do the trick! Purging you pip caches will force pip to start from scratch when downloading numpy. The download may take more time, but it should help in installing the proper architecture.
我有一个稍微不同的问题。我在我的 m1 mac mini 上本地运行 openai/whisper,非常完美。
但是,当我在从虚拟机 sshing 后触发相同的作业时,它会抛出上面相同的不兼容...错误。
现在,通常当我运行耳语时,我只是直接运行它。
为了解决这个问题,我必须在将要运行的 python 进程上指定所需的体系结构
即
希望它可以帮助某人。
I've got a slight different problem. I'm running openai/whisper on my m1 mac mini locally, perfectly.
However when I'm triggering the same job in after sshing from a VM, it is throwing the same incompatible...error above
Now, usually when I'm running whisper I'm just running it directly.
To workaround the problem I've to specify the desired architecture on the python process that is going to run whisper
i.e.
hope it helps someone.