[英]Unable to import psutil on M1 mac with miniforge: (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64e'))
I'm using a miniforge environment on an M1 mac, and unable to import psutil:我在 M1 mac 上使用 miniforge 环境,无法导入 psutil:
ImportError: dlopen(/Users/caspsea/miniforge3/lib/python3.9/site-packages/psutil/_psutil_osx.cpython-39-darwin.so, 0x0002): tried: '/Users/caspsea/miniforge3/lib/python3.9/site-packages/psutil/_psutil_osx.cpython-39-darwin.so' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64e')), '/usr/local/lib/_psutil_osx.cpython-39-darwin.so' (no such file), '/usr/lib/_psutil_osx.cpython-39-darwin.so' (no such file)
I tried uninstalling and reinstalling using pip but that did not work.我尝试使用 pip 卸载并重新安装,但这不起作用。 I'm using python 3.9, OS Monterey 12.2.1我正在使用 python 3.9,OS Monterey 12.2.1
Have you tried:你有没有尝试过:
pip uninstall psutil
followed by:其次是:
pip install --no-binary :all: psutil
Thanks Jude's answer.谢谢裘德的回答。
I encontered ImportError: dlopen...(mach-o file, but is an incompatible architecture (have (x86_64), need (arm64e)) when I run Jupyter Lab from new MacBook.当我从新 MacBook 运行 Jupyter Lab 时,我遇到了 ImportError: dlopen...(mach-o file, but is an incompatible architecture (have (x86_64), need (arm64e))。
And when trying intall psutil, I got当尝试 intall psutil 时,我得到了
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun error: command '/usr/bin/clang' failed with exit code 1 [end of output] xcrun:错误:无效的活动开发者路径(/Library/Developer/CommandLineTools),在:/Library/Developer/CommandLineTools/usr/bin/xcrun 错误:命令“/usr/bin/clang”失败,退出代码 1 [输出结束]
note: This error originates from a subprocess, and is likely not a problem with pip.注意:此错误源自子进程,可能不是 pip 的问题。 ERROR: Failed building wheel for psutil Failed to build psutil ERROR: Could not build wheels for psutil, which is required to install pyproject.toml-based projects错误:无法为 psutil 构建轮子 无法构建 psutil 错误:无法为 psutil 构建轮子,这是安装基于 pyproject.toml 的项目所必需的
to fix that, I download xcode为了解决这个问题,我下载了 xcode
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.