使用cx_freeze打包生成exe方法及问题解决

生成的setup.py程序:CheckoutTool_V2_4.py是要生成exe的py文件,与setup.py同个目录下,进入setup.py的目录下的命令行,使用指令python setup.py dist,生成的程序就在dist文件夹下

import sys
#import os
from cx_Freeze import setup, Executable

base = None
if sys.platform == 'win32':
    base = 'Win32GUI'

executables = [
    Executable('CheckoutTool_V2_4.py', targetName='CheckoutTool_V2_4.exe', base=base,icon='query.ico')
]

include_files = []

buildOptions = dict(
    packages=[], excludes=[],
    include_files=include_files,
)

setup(
    name='测试1.0',
    version='1.0',
    description='测试',
    options=dict(build_exe=buildOptions),
    executables=executables
)

解决问题1:链接:https://stackoverflow.com/questions/47911544/python-cx-freeze-importerror-cannot-import-name-idnadata

Python cx_Freeze ImportError: cannot import name 'idnadata'

解决方法:Update: I have found that manually copying the dependencies into the lib folder of the build fixed the problem as it was only copying half of the idna module.(更新:我发现手动将依赖项复制到构建的lib文件夹中解决了这个问题,因为它只复制了idna模块的一半。)其他问题可根据该方法解决

解决问题:

ImportError: No module named 'queue' while running my app freezed with cx_freeze

解决方法:链接:https://www.e-learn.cn/content/wangluowenzhang/1658004

import requests
from multiprocessing import Queue

你可能感兴趣的:(python学习,PyQt5学习)