简体   繁体   English

通过命令行修复 python 安装

[英]Repairing python installation via command line

I have a package that contains the CPython installer and attempts to install it for the client.我有一个包含 CPython 安装程序并尝试为客户端安装它的 package。

In the event that there is a corrupt install, the %ERRORLEVEL% variable gets set to 1603 .如果安装损坏,则%ERRORLEVEL%变量将设置为1603 From the docs I can issue a command to uninstall, but it will fail in the installed instance requires a repair (such as the user deleted the directory before trying to uninstall).文档中我可以发出一个命令来卸载,但它会在已安装的实例中失败,需要修复(例如用户在尝试卸载之前删除了目录)。 To resolve I'd like to attempt a repair using the installer in this case, but the docs do not list a way to do this via the command line.为了解决这个问题,我想在这种情况下尝试使用安装程序进行修复,但文档没有列出通过命令行执行此操作的方法。

I believe the installer is an MSI labeled as an EXE as the source uses WiX.我相信安装程序是一个标记为 EXE 的 MSI,因为使用 WiX。 I'm not intimately familiar with MSI or WiX, but I'd think there is some way to access the "Repair" feature available from double clicking the installer via the command line.我对 MSI 或 WiX 并不十分熟悉,但我认为有一些方法可以通过命令行双击安装程序来访问“修复”功能。

Is there a way to accomplish this?有没有办法做到这一点?

Using Powershell, do this: Invoke-Expression "& 'D:\python-3.9.5-amd64.exe' /repair /passive"使用 Powershell,执行以下操作: Invoke-Expression "& 'D:\python-3.9.5-amd64.exe' /repair /passive"

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM