Skip to main content
 首页 » 编程设计

python之如何在 Inno Setup 中使用 Pip 安装 Python 包

2024年10月01日8artech

如何在 Inno Setup 中使用 Pip 安装 Python 库(例如 requests、jinja2、falcon 等)**?

我知道一种在 Inno Setup 中使用 Pip 安装 Python 库的方法(下面只是一个示例代码):

Inno 安装文件:

[Files] 
FileName: "python_file.py"; 

python_file.py

import subprocess 
subprocess.call(["pip", "install", "requests"]) 

请问有没有其他方法可以在 Inno Setup 中使用 Pip 安装 Python 库?

请您参考如下方法:

由于 pip 是一个独立的可执行文件,您可以使用 [Run] section 像执行任何其他可执行文件一样执行它:

[Run] 
Filename: "pip.exe"; Parameters: "install requests"; StatusMsg: "Installing requests..."