39 lines
1.6 KiB
Markdown
39 lines
1.6 KiB
Markdown
|
|
---
|
|||
|
|
outline: deep
|
|||
|
|
sub-order: 3
|
|||
|
|
---
|
|||
|
|
|
|||
|
|
# 打包与安装包
|
|||
|
|
|
|||
|
|
## 打包(Nuitka)
|
|||
|
|
|
|||
|
|
可使用以下命令生成独立可执行文件:
|
|||
|
|
|
|||
|
|
```bash
|
|||
|
|
nuitka --standalone --windows-console-mode=disable --windows-uac-admin --include-data-files=columba.ico=./columba.ico --windows-icon-from-ico=columba.ico 3.py
|
|||
|
|
```
|
|||
|
|
|
|||
|
|
## 制作安装包(Inno Setup)
|
|||
|
|
|
|||
|
|
[Inno Setup](https://jrsoftware.org/isinfo.php)是一个非常好用的安装包制作软件。本软件由于需要管理员权限,直接打包会出现「要求的操作需要提升的权限」的错误消息,您可以参考一下步骤编辑iss脚本配置权限:
|
|||
|
|
|
|||
|
|
1. 在 Inno Setup 的 Script 的 [Setup] 中加上:`PrivilegesRequired=admin`
|
|||
|
|
|
|||
|
|
2. 在 [Run] 所有的 Flags 都加上:`runascurrentuser`,例如:
|
|||
|
|
|
|||
|
|
```
|
|||
|
|
[Run]
|
|||
|
|
Filename: "{app}\{#MyAppExeName}"; Description: "{cm:LaunchProgram,{#StringChange(MyAppName, '&', '&&')}}"; Flags: nowait postinstall skipifsilent runascurrentuser
|
|||
|
|
|
|||
|
|
```
|
|||
|
|
|
|||
|
|
除此之外,由于v3.x版本起,配置文件保存与用户目录下的/.columba,因此你需要将配置文件包含并释放于该目录,以确保软件正常运行,您可以参考以下步骤配置相关资源:
|
|||
|
|
|
|||
|
|
1. 从Github中下载相关文件
|
|||
|
|
2. 在 [Files]中添加以下嘞如
|
|||
|
|
```
|
|||
|
|
Source: "[your_files_path]\config\config.json"; DestDir: "{%USERPROFILE}\.columba"; Flags: onlyifdoesntexist ignoreversion
|
|||
|
|
Source: "[your_files_path]\config\login_notifier.log"; DestDir: "{%USERPROFILE}\.columba"; Flags: onlyifdoesntexist ignoreversion
|
|||
|
|
Source: "[your_files_path]\config\failure_login.json"; DestDir: "{%USERPROFILE}\.columba"; Flags: onlyifdoesntexist ignoreversion
|
|||
|
|
|
|||
|
|
```
|