3

我正在使用 python 3.9 在 Cython 和 py2app 中编译一个简单的 Qt6“Hello World”应用程序。它在 CPython 3.9 下运行良好。它可以正确编译,但无法在 Cython 中运行。

以下是项目文件:

测试负载.pyx

import sys
from PyQt6.QtWidgets import QMessageBox, QApplication

def main():
    app = QApplication(sys.argv)
    QMessageBox(text="Hello World").exec()

if __name__ == "__main__":
    main()

主要.py

import testLoad
from logging import basicConfig

def main():
    testLoad.main()

if __name__ == '__main__':
    main()

setup.py

""""
Usage:
    python setup.py py2app
"""

from setuptools import setup
from Cython.Build import cythonize
from Cython.Distutils import build_ext


setup(
    name='test',
    # Include additional files into the package using MANIFEST.in
    include_package_data=True,
    app= ['__main__.py'],
    data_files=[],
    cmdclass = {'build_ext': build_ext},
    ext_modules = cythonize(["testLoad.pyx"], language_level=3),

    setup_requires=['py2app'],
    options={
             'cython': {"language_level":"3"}
            },
    install_requires=[
        "Cython"
    ],
    entry_points={
        "console_scripts": [
            "testLoad = __main__:main"
        ]
    },
)

当我运行程序时,我在控制台上收到此错误:

erreur  17:04:44.035551-0400    test    MTLIOAccelDevice bad MetalPluginClassName property (null)
erreur  17:04:44.047081-0400    test    +[MTLIOAccelDevice registerDevices]: Zero Metal services found

任何想法 ?

4

0 回答 0