[功能异常] Windows自带解压工具导致DLL加载失败

Author: sylvia-hwCreated Aug 14, 2026Updated Aug 14, 2026
Labels文档补充(docs)适合新手(good first issue)

问题描述

使用 Windows 自带的解压功能(右键 → 解压到当前文件夹)解压软件包后,运行 XHS-Downloader.exe 会闪退,错误提示 RuntimeError: Failed to resolve Python.Runtime.Loader.Initialize。

实际原因是 Windows 的"附件安全标记"机制导致 .dll 文件被锁定,.NET 运行时拒绝加载。

重现步骤

1、从 GitHub构建可执行文件 下载 XHS-Downloader_Windows_X64_20260814.zip 2、使用 Windows 自带解压功能(右键 → 全部解压缩到当前文件夹) 3、双击 XHS-Downloader.exe 运行 4、程序闪退

错误日志

RuntimeError: Failed to resolve Python.Runtime.Loader.Initialize from E:\XHS-Downloader_Windows_X64_20260814\lib\pythonnet\runtime\Python.Runtime.dll

使用“1”个参数调用“LoadFrom”时发生异常:“未能加载文件或程序集 "file:///E:...\Python.Runtime.dll"或它的某一个依赖项。不支持操作。 (异常来自 HRESULT:0x80131515)”

根本原因

Windows 对从网上下载的文件会添加安全标记,自带解压时这个标记会继承给 .dll 文件,导致 .NET 运行时拒绝加载。第三方解压工具不会继承此标记。

解决方案

● 使用 7-Zip、WinRAR 或 Bandizip 解压 ● 或右键 .zip → 属性 → 解除锁定 → 再解压 ● 或在 PowerShell 中执行 Get-ChildItem -Recurse | Unblock-File

环境

● 系统:Windows 10/11 ● 版本:XHS-Downloader_Windows_X64_20260814 ● .NET Framework:4.8.09221

Source: JoeanAmier/XHS-Downloader