gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-12-01 09:33:38 26 4
gpt4 key购买 nike

我在 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/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com