【问题标题】:.msi Shortcut with cx_Freeze.msi 使用 cx_Freeze 的快捷方式
【发布时间】:2017-06-02 18:08:04
【问题描述】:

我正在尝试使用 cx_Freeze for Python 3 创建一个 .msi。我可以创建 .msi 没问题,它可以正常安装并创建一个快捷方式,但快捷方式不起作用,因为快捷方式没有运行安装的目录。非常感谢任何帮助或建议。

【问题讨论】:

标签: python python-3.x windows-installer installation exe


【解决方案1】:

确保在构建分发包时设置了工作目录选项。 您可以制作一个包含所有选项设置的表格,如下所示:

from cx_Freeze import *

shortcut_table = [
    ("DesktopShortcut",         # Shortcut
     "DesktopFolder",           # Directory_
     "appName_shortcut",                 # Name
     "TARGETDIR",               # Component_
     "[TARGETDIR]appName.exe",  # Target
     None,                      # Arguments
     None,                      # Description
     None,                      # Hotkey
     None,                      # Icon
     None,                      # IconIndex
     None,                      # ShowCmd
     'TARGETDIR'                # WkDir
     )
    ]
options = {
    'bdist_msi': {
        'data': {"Shortcut": shortcut_table},
    },
}
setup(
    name="appName",
    options=options,
    version="0.0.1",
    description='descr',
    executables=[Executable("appName.py", base=base,)]
)

您也可以像这样简单地将shortCutNameshortcutDir 选项提供给可执行文件:

from cx_Freeze import *

setup(
    executables = [
        Executable(
            "appName.py",
            shortcutName="appName_shortcut",
            shortcutDir="DesktopFolder",
            )
        ]
    )

基于this 的回答。

【讨论】:

  • 谢谢伙计。我已经很久没用过python了,但也许它可以帮助别人。
猜你喜欢
  • 2014-08-03
  • 1970-01-01
  • 2015-04-27
  • 2017-10-12
  • 1970-01-01
  • 1970-01-01
  • 2019-10-02
  • 2013-03-22
相关资源
最近更新 更多