本文介绍了我如何使用 M1chip 在我的 Mac 上运行 pyqt5的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

现在.当我运行它时.错误在于ImportError: dlopen(/Users/vihanmy/Library/Python/3.8/lib/python/site-packages/PyQt5/QtWidgets.abi3.so, 2): 没有找到合适的图像.有没有发现:/Users/vihanmy/Library/Python/3.8/lib/python/site-packages/PyQt5/QtWidgets.abi3.so:mach-o,但架构错误/Users/vihanmy/Library/Python/3.8/lib/python/site-packages/PyQt5/QtWidgets.abi3.so:mach-o,但架构错误

now. when i run it. the error conmesImportError: dlopen(/Users/vihanmy/Library/Python/3.8/lib/python/site-packages/PyQt5/QtWidgets.abi3.so, 2): no suitable image found. Did find:/Users/vihanmy/Library/Python/3.8/lib/python/site-packages/PyQt5/QtWidgets.abi3.so: mach-o, but wrong architecture/Users/vihanmy/Library/Python/3.8/lib/python/site-packages/PyQt5/QtWidgets.abi3.so: mach-o, but wrong architecture

推荐答案

经过数小时的反复试验,我终于能够解决这个问题.我的成功配置是:

After hours of trial and error, I was finally able to solve this. My successful configuration is:

  1. 使用 Rosetta 2 打开终端(https://dev.to/courier/tips-and-tricks-to-setup-your-apple-m1-for-development-547g)
  2. 使用非自制 python(我的在/usr/bin/python3 中)创建虚拟环境
/usr/bin/python3 -m venv env
source env/bin/activate
  1. 升级pip
pip install --upgrade pip
  1. 安装 PyQt5
pip install PyQt5

这篇关于我如何使用 M1chip 在我的 Mac 上运行 pyqt5的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-11 00:45