使用MSIX Packaging Tool打包Python(QtPy)应用安装失败,报错0x80070570的原因及替代方案咨询
Hi there! Let’s start by recapping your current workflow and then dig into the error you’re facing, plus simpler ways to reach your goal of a QtPy-based single-app kiosk on Windows.
Your current setup:
- You have a simple QtPy Python app:
from qtpy.QtWidgets import QApplication, QLabel from qtpy.QtCore import Qt if __name__ == "__main__": # Create the application instance app = QApplication([]) # Create a fullscreen label label = QLabel("Hello World!") label.setStyleSheet("font-size: 40px; text-align: center;") # Increase text size label.setAlignment(Qt.AlignCenter) # Center the text label.showFullScreen() # Make it fullscreen # Run the application event loop app.exec_() - You’re using
PyInstallerto build a single executable, thenInno Setup Compilerto convert that into a traditional installer, and finallyMSIX Packaging Toolto wrap the installer into an MSIX package. But installing the MSIX fails with this error:App installation failed with error message: Common::Deployment::MsixvcStagingSession::GetManifestReader in MsixvcStagingSession failed with error 0x80070570. (0x80070570)
报错0x80070570的可能原因
The error code 0x80070570 translates to "The file or directory is corrupted and unreadable" in Windows system terms. For your multi-step workflow, here are the most likely causes:
- Corrupted capture during MSIX conversion: When the MSIX Packaging Tool wraps an Inno Setup installer, it captures every filesystem and registry change during installation. If this capture is interrupted, or if the Inno Setup installer does non-standard actions (like writing to protected system directories, or relying on temporary files that get cleaned up mid-capture), the resulting MSIX package can end up with missing/corrupted files or an invalid manifest.
- Inno Setup actions incompatible with MSIX: MSIX packages run in a sandboxed environment with strict rules about where they can write data. If your Inno Setup script writes to locations like
C:\WindowsorHKEY_LOCAL_MACHINE(outside the app's dedicated sandbox folder), the MSIX conversion can't properly encapsulate those changes, leading to a corrupted package. - PyInstaller executable issues: If the single-file exe from PyInstaller has hidden dependency issues or corrupted embedded resources, these problems will carry over to the MSIX package, causing installation failures.
更简便的打包方案(跳过繁琐的多步骤转换)
Instead of chaining three tools together, here are streamlined approaches to package your app for Windows, with built-in support for MSIX and kiosk mode:
1. 直接用PyInstaller生成MSIX(推荐)
Recent versions of PyInstaller (5.0+) have built-in support for generating MSIX packages directly, eliminating the need for Inno Setup entirely. Here's how to use it:
- Make sure you're running PyInstaller 5.0 or newer (update with
pip install --upgrade pyinstallerif needed). - Run your PyInstaller command with the
--msixflag, plus your usual options:
This will generate a ready-to-use MSIX package directly from your Python script, handling all QtPy dependencies automatically. You can customize MSIX-specific details like app name or publisher with additional flags:pyinstaller --onefile --windowed --msix "your_script_name.py"pyinstaller --onefile --windowed --msix --msix-product-name="My Kiosk App" --msix-publisher="CN=Your Name" "your_script_name.py"
2. 使用Nuitka替代PyInstaller
Nuitka compiles Python code directly to C/C++ binaries, resulting in smaller, faster executables with fewer dependency headaches. It also supports MSIX packaging via its plugin system:
- Install Nuitka and required dependencies:
pip install nuitka zstandard - Compile your app with MSIX support:
This will produce both a standalone executable and a fully functional MSIX package.nuitka --standalone --windows-disable-console --enable-plugin=qt-plugins --output-dir=dist --msix "your_script_name.py"
3. 针对单应用Kiosk模式的额外配置
Since your end goal is to run this as a single-app kiosk on Windows, here are key steps once you have your MSIX package:
- Get the package family name: You'll need this to set up Assigned Access. Run this PowerShell command to find it:
Get-AppxPackage *your-app-name* | Select-Object PackageFamilyName - Set up Windows Assigned Access: Use Windows' built-in Assigned Access feature to lock the machine to your app. You can do this via Settings (Accounts > Family & other users > Set up assigned access) or Group Policy for enterprise deployments.
- Optimize for fullscreen: Your current
showFullScreen()call already handles this, but addingapp.setApplicationDisplayName("My Kiosk App")will make it easier to identify your app in Assigned Access settings.
总结
The 0x80070570 error is almost certainly caused by a corrupted package from your multi-step conversion workflow. Switching to direct MSIX generation via PyInstaller or Nuitka will simplify your process and reduce the chance of such errors. Once you have your MSIX package, setting up kiosk mode using Windows' built-in tools is straightforward.
备注:内容来源于stack exchange,提问作者Mark wijkhuizen

