我需要帮助将.py文件转换为.exe fi

2024-10-05 14:25:43 发布

您现在位置:Python中文网/ 问答频道 /正文

我正在尝试使用cx freeze将.py文件转换为.exe文件。我已经安装了cxfreeze并将python添加到我的计算机路径中。但是,使用下面的代码,我应该找到qwindows.dll用python33归档。我似乎找不到文件,不仅如此,我似乎找不到平台文件夹。我尝试过卸载pyqt4并使用安装程序重新安装它,同时也安装了pyqt5。我还是找不到文件夹/文件…什么都没用??!!!在

我使用的代码是:

import sys

from cx_Freeze import setup, Executable

base = "Win64GUI"
path_platforms = ( "C:\Python33\Lib\site-packages\PyQt4\plugins\platforms\qwindows.dll", "platforms\qwindows.dll" )###Find directory of qwindows.dll###
build_options = {"includes" : [ "re", "atexit" ], "include_files" : [ path_platforms ]}

setup(
    name = "Starters 'R' Us", ###Janu change your name here###
    version = "0.1",
    description = "Maths Assessment System",
    options = {"build_exe" : build_options},
    executables = [Executable("MyProgram.py", base = base,shortcutName="Starters 'R' Us",shortcutDir="DesktopFolder")]###Change the .py file to yours.###
    )
###the shortcut creates shortcut on your desktop###

Tags: 文件代码pyimportbuild文件夹basesetup