简体   繁体   中英

mach-o file, but is an incompatible architecture have 'x86_64', need 'arm64e' M1 MAC

from PyQt6.QtWidgets import *

from model.Department import Department
from view.main_window import Ui_Form
from model.Department import Department, Employee

class Homewidget(QWidget,Ui_Form):

    def __init__(self):
        QWidget.__init___(self)
        self.setupUi(self)

        self.depts = Department.get_all_depts()
        self.load_depts

        self.emps= Employee.get_all_emps()
        self.load_emps

        self.cb_depts.currentIndexChanged.connect(self.filter_emps_by_dept)
        self.le_search.textChanged.connect(self.filter_emps_by_name)


    def load_depts(self):
        names = [d.dept_name for d in self.depts]
        self.cb_depts.addItems(names)
    def load_emps(self):
        self.tb_emps.setRowCount(0)
        for i, e in self.emps:
            self.tb_emps.insertRow(i)
            for j, info in enumerate(e.__dict__.values()):
                self.tb_emps.setItem(i , j, QTableWidgetItem(str(info)))

    def filter_emps_by_dept(self, idx):
                    self.load_emps()
                    if idx != 0:
                        dept = self.depts[idx - 1]
                        for i, e in enumerate(self.emps):
                            if e.dept_id != dept.dept_id:
                                self.tb_emps.hideRow(i)
    def filter_emps_by_name(self):
        self.load_emps()
        query = self.le_search.text().lower()
        if query != "":
            for i , e in enumerate(self.emps):
                if not e.emp_name.lower().startswith(query):
                    self.tb_emps.hideRow(i)}

app = QApplication([])
window = Homewidget()
window.show()
app.exec()

this is the error I'm facing on my m1 MacBook Pro Monetery can't run my GUI project for school. the PyQt6 comes with default in arm64 and I'm not sure but I think my software is arm64e I am new to osx idk what to do can I change the software from arm64e to arm64?

this is the error I'm facing below...

ahmed@Ahmeds-MacBook-Pro hr_system % /usr/local/bin/python3 >/Users/ahmed/hr_system/app.py Traceback (most recent call last): File "/Users/ahmed/hr_system/app.py", line 1, in from PyQt6.QtWidgets import * ImportError: >dlopen(/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/sit>e-packages/PyQt6/QtWidgets.abi3.so, 0x0002): Library not loaded: >@rpath/QtWidgets.framework/Versions/A/QtWidgets Referenced from: >/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site->packages/PyQt6/QtWidgets.abi3.so Reason: tried: >'/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site->packages/PyQt6/Qt6/lib/QtWidgets.framework/Versions/A/QtWidgets' (mach-o >file, but is an incompatible architecture (have 'x86_64', need 'arm64e')), >'/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site->packages/PyQt6/Qt6/lib/QtWidgets.framework/Versions/A/QtWidgets' (mach-o >file, but is an incompatible architecture (have 'x86_64', need 'arm64e')), >'/System/Libr ary/Frameworks/QtWidgets.framework/Versions/A/QtWidgets' (no >such file)

FYI, you can see the package files available on the pypi.org web site (see: https://pypi.org/project/PyQt6/#files ).

The macos.whl file (it's just a zip file) includes a number of.so files and they are all dual architecture (ie they contain x86_64 and arm64). The link above does include the "source" package which you can rebuild from, but you will need to install XCode and developer tools.

You don't need arm64e and M1 can run either arm64 or arm64e architecture binaries. I suspect something else is the problem. I would create a venv, install everything in there and then look for any.so files which don't support arm64. For example, with:

find . -name "*.so" -exec file {} \;

Also make sure you aren't running some really old version of PyQT6.

If you upgraded your Mac from Intel to M1 and kept your home directory or any other installed software, those packages that were retained need to be reinstalled. This includes python packages installed with pip install --user (under ~/.local), as well as anything in a virtualenv.

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