QPrinter在cx-Freeze之后没有看到任何打印机

时间:2018-05-17 06:36:45

标签: python pyqt5 cx-freeze qprinter

使用Python上的GUI(win32上的3.6.5),PyQt5(5.10.1),使用cx_Freeze(5.1.1)。

有使用打印机的功能。 py:

    def goPrinter(self):
        print("___goPrinter")
        printer = QtPrintSupport.QPrinter()
        print(printer)
        print(printer.printerName())
        print(QtPrintSupport.QPrinterInfo.availablePrinterNames())
        print("return")

当我运行 py - 脚本时,打印机工作正常。

CMD:

  

-__ goPrinter

     

-PyQt5.QtPrintSupport.QPrinter对象位于0x02FF1EBO>

     

-Microsoft XPS Document Writer

     

- [' Microsoft XPS文档编写者','传真']

     

-return

当我运行 exe 文件(在cx-Freeze之后)时,任何打印机都是不可见的。印刷不起作用。

CMD:

  

-__ goPrinter

     

-PyQt5.QtPrintSupport.QPrinter对象位于0x02BB23B0>

     

-

     

- []

     

-return

用于创建exe的

setup.py 脚本:

    from cx_Freeze import setup, Executable

    executables = [Executable('KIWI_1105.py',
                      targetName='KIWIv17.exe',
                      icon='iconsN\capsule.ico',
                      shortcutName='KIWI',
                      shortcutDir='DesktopFolder'
    )]

    excludes = ['email', 'http', 'urllib', 'unittest']

    zip_include_packages = ['collections','distutils', 'encodings',
                            'importlib', 'logging', 'imageformats',
                            'platforms', 'PIL', 'pydoc_data', 'PyQt5', 'xml']

     include_files = ['iconsN', 'Atlas']

     options = {
               'build_exe': {
                   'excludes': excludes,
                   'zip_include_packages': zip_include_packages,
                   'include_files': include_files,
                   'include_msvcr': True,
                   'build_exe': 'KIWI',
               }
     }

     setup(name='KIWI App',
           author='23',
           version='17.1505',
           description='KIWI Viewer Application',
           executables=executables,
           options=options)

0 个答案:

没有答案