pythondistutils安装_安装msi后的python distutils

博主使用Python的distutils的bdist_msi命令创建MSI安装程序,希望在安装程序包后运行代码。文中给出了相关代码,包括导入必要模块、自定义命令类以实现安装后复制快捷方式到开始菜单和启动文件夹等操作。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

我正在用distutilsbdist_msi命令创建一个msi安装程序。在我的设置文件中,

我想在msi安装程序包后运行代码,请帮助。。在from distutils.core import setup

from distutils.command.bdist_msi import bdist_msi

import os

import shutil

STARTMENU = "C:/ProgramData/Microsoft/Windows/Start Menu/Programs/ShotExplorer"

STARTUP = "C:/ProgramData/Microsoft/Windows/Start Menu/Programs/Startup"

LINK = r"C:\Python27\Lib\site-packages\shotexplorer\ShotExplorer.lnk"

class MyCommand(bdist_msi):

def run(self):

bdist_msi.run(self)

print "Creating Start Menu Entries"

if not os.path.exists(STARTMENU):

os.makedirs(STARTMENU)

shutil.copy(LINK, STARTMENU)

shutil.copy(LINK, STARTUP)

setup(

name = "shotexplorer",

version = "1.0",

description = "Tool to explore shots on isilon",

author = "abhishek.garg",

author_email = "abhishekgarg12@yahoo.com",

packages = ["shotexplorer", "shotexplorer.pyHook"],

package_data = {"":["explorer.ico","quicktime.png","ShotExplorer.lnk","pyHook/_cpyHook.pyd"]},

include_package_data = True,

cmdclass = {'bdist_msi':MyCommand}

)

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值