You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

在AppVeyor上静默安装Python 3.5.0+失败,寻求解决方案

Troubleshooting Python 3.6.3 Installation Failure on AppVeyor

Let’s break down the issue you’re facing with installing Python 3.6.3 via subprocess.check_output on AppVeyor, and walk through actionable fixes to resolve the non-zero exit code error.

From the installation log details you shared, this failure is most likely tied to one of four common issues: permission conflicts, parameter formatting errors, target directory conflicts, or a corrupted installation package. Here’s how to address each:

Fixes to Try

1. Adjust Parameter Formatting & Add Critical Flags

Your current parameter list uses Unicode strings (u'...') which can cause encoding glitches in Python 2’s subprocess module. Additionally, adding the /norestart flag prevents unexpected system restarts that might interrupt the install process.

Update your parameter list to use standard strings (drop the u prefix) and tweak the order for better compatibility:

install_args = [
    'python-3.6.3-amd64.exe',
    '/quiet',
    '/norestart',
    'TargetDir=C:\\Python363-x64',
    'AssociateFiles=0',
    'Shortcuts=0',
    'Include_doc=0',
    'Include_launcher=0',
    'InstallLauncherAllUsers=0',
    'Include_tcltk=0',
    'Include_test=0'
]

2. Clean the Target Directory Before Installation

If the C:\\Python363-x64 directory already exists (from a previous failed install), the installer will throw an error when trying to write to it. Add this cleanup code before running the installer:

import os
import shutil

target_dir = r'C:\Python363-x64'
if os.path.exists(target_dir):
    shutil.rmtree(target_dir)

3. Verify the Installer’s Integrity

Corrupted installers are a frequent culprit. Instead of relying on a pre-downloaded file, re-download the installer directly in your AppVeyor build script (using PowerShell) to ensure it’s intact:

Invoke-WebRequest -Uri "https://www.python.org/ftp/python/3.6.3/python-3.6.3-amd64.exe" -OutFile "python-3.6.3-amd64.exe"

For extra safety, add a SHA256 checksum validation (grab the official checksum from Python’s download page):

$expectedHash = "d93a841d9f71ae5f06e39902e0917ec1f8f7472f617b280b4211b48d4d863e6d"
$actualHash = (Get-FileHash -Path "python-3.6.3-amd64.exe" -Algorithm SHA256).Hash
if ($actualHash -ne $expectedHash) {
    Write-Error "Installer corrupted! Hash mismatch."
    exit 1
}

4. Use AppVeyor’s Built-in Python Support (Easiest Fix!)

AppVeyor maintains pre-installed versions of Python, so you don’t need to manually run the installer at all. Configure your appveyor.yml to use the exact Python version you need:

environment:
  PYTHON: "C:\\Python36-x64"
  PYTHON_VERSION: "3.6.3"
  PYTHON_ARCH: "64"

install:
  - ps: |
      $env:PATH = "$env:PYTHON;$env:PYTHON\Scripts;$env:PATH"
      python --version
      pip --version

This method is far more reliable than manual installation, as AppVeyor handles all setup, permissions, and version management for you.


内容的提问来源于stack exchange,提问作者AXO

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.22 09:21:10