Python 开发工作负载无法在 Visual Studio 中安装

适用于: Visual Studio 2022

现象

Python 开发工作负载无法在 Visual Studio 中安装。 此外,还会看到以下错误消息:

Package 'CPython39.Exe.x64,version=3.9.13, chip=x64' failed to download from 'https://go.microsoft.com/fwlink/?linkid=2222466'.
Search URL
https://aka.ms/VSSetupErrorReports?q=PackageId=CPython39.Exe.x64; PackageAction=DownloadPackage; ReturnCode=0x80096004
Details
WebClient download failed: Authenticode verification returned 0x800b0003 for path: python-3.9.13-amd64.exe.
Bits download failed: Timeout reached for job VsBitsDownloadJob - -2114796084 whilst in state BG_JOB_STATE_CONNECTING WinInet download failed: Authenticode verification returned 0x800b0003 for path: python-3.9.13-amd64.exe.
Impacted workloads
Python development (Microsoft.VisualStudio.Workload.Python,version=17.5.33306.270)
Impacted components
Python 3 64-bit (3.9.13) (Component.CPython39.x64,version=3.9.13)

原因

Visual Studio 安装程序无法从 URL https://go.microsoft.com/fwlink/?linkid=2222466下载python-3.9.13-amd64.exe文件。

解决方法

若要解决此问题,请确保将下载文件所需的域和服务器添加到允许列表。

通过将必要的域 URL 添加到允许列表,可以启用Visual Studio 安装程序下载所需的文件并成功安装 Python 开发工作负载。 有关要添加到允许列表的 URL 的详细信息,以及有关在防火墙或代理服务器后面安装 Visual Studio 的指南,请参阅 在防火墙或代理服务器后面安装和使用 Visual Studio 和 Azure 服务。

完成允许列表过程后,可以在 Visual Studio 中安装 Python 开发工作负载 ,而不会遇到任何下载失败。