python - 使用特定 TargetDir 以/安静模式安装 Python 可执行文件

标签 python installation appveyor

我在 AppVeyor 上安装 python 3.5.0+ 时遇到问题。我用来调用 subprocess.check_output 的参数是:

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

安装程序返回一个非零状态代码以及以下日志文​​件:

https://pastebin.com/jmMpiXmH

(抱歉使用了pastebin,它很长并且显然stackoverflow有字符限制)

安装程序退出后,请求的 TargetDir (C:\\Python363-x64) 中不会安装任何 python。实际上该目录甚至没有创建,如果我事先手动创建它也没有帮助。

我尝试首先运行 /uninstall (认为它可能会跳过安装,因为已经安装了 appveyor 版本),但同样的问题仍然存在。我尝试过 /passive/quiet 选项。我也在其他 python 版本(3.5.0+)上尝试过这个,但没有成功。 (早期版本有 .msi 安装程序,并且安装正确)

我想知道是否有其他人可以重现此问题,或者您是否知道我做错了什么。

最佳答案

这是在 AppVeyor 环境中安装 Python 3.6.4 的示例 PowerShell 脚本:

Write-Host "Installing Python 3.6.4 x64..." -ForegroundColor Cyan
Write-Host "Downloading..."
$exePath = "$env:TEMP\python-3.6.4-amd64.exe"
(New-Object Net.WebClient).DownloadFile('https://www.python.org/ftp/python/3.6.4/python-3.6.4-amd64.exe', $exePath)
Write-Host "Installing..."
cmd /c start /wait $exePath /quiet TargetDir=C:\Python36-x64 Shortcuts=0 Include_launcher=1 InstallLauncherAllUsers=1

请随意根据您的需要采用它。

关于python - 使用特定 TargetDir 以/安静模式安装 Python 可执行文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49734767/

相关文章:

python - Django:从 Form clean 方法调用自定义模型方法。 "Unbound Method"?

visual-studio - Visual Studio Community 2013 Update 4 安装失败

c# - Appveyor nuget分析器

r - 如何在 R 版本 3.2.1 for Mac 中安装 ggplot2

windows - 如何在 Windows 上安装和使用 cURL?

github - 将 Markdown 文档推送到 NuGet.org

uwp - 使用 MSBuild 构建 Windows 应用商店应用程序时如何跳过打包步骤?

python - 如何在 Pandas 的字符串末尾添加特定数量的字符?

python - 无法使用预先签名的 url Minio Python 加载对象

python - Raspbian Jessie (RPI3) 引导选项未启动桌面