在 windows 7 64 位上安装巧克力时出错

Error when installing chocolatey on windows 7 64 bits

我正在尝试在 windows 7 64 位上安装 chocolatey。正在使用文档 Here 当我在命令提示符下键入以下代码时。

PowerShell Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))

它抛出错误,如下面的屏幕截图所示

我不知道错误是怎么回事。我只是在运行它之前在代码前面添加了 Powershell

Chocolatey 网站需要 TLS 1.2 才能访问它并从中下载安装脚本。

查看 this blog post,它解释了更改,您可以 运行 在 PowerShell 中使用的命令,看看您是否受支持,以及您可以为较旧的遗留系统(例如Windows7).

升级你的 power shell 版本并尝试在升级我的 powershell 版本后得到这个错误 geon

好的,如果我回来,我会记录将 chocolatey 安装到 Windows 7.

的整个过程
  1. 安装所有 Windows 更新。
    1. 检查更新。
    2. 安装更新
    3. 重启
    4. 重复上述步骤一百万次,直到没有新的更新(约 20 小时)。
  2. 安装NET4.5 如果没有安装,应该安装。
  3. 安装Windows管理框架WMF
  4. 安装powershell
    1. 转到https://docs.microsoft.com/en-us/powershell/scripting/install/installing-powershell-on-windows?view=powershell-7.2
    2. 点击MSI package
    3. 下载并安装。
  5. 运行 powershell 作为管理员。
    1. 从官方安装 chocolatey link https://chocolatey.org/install
  6. 清理光盘 C: 以从 windows 更新中删除所有临时文件(在我的情况下为 ~7GB)

您需要 TLS 1.2 或进行离线安装。

- 检查 windows 更新

- 在此处下载简易修复程序。

https://support.microsoft.com/en-us/topic/update-to-enable-tls-1-1-and-tls-1-2-as-default-secure-protocols-in-winhttp-in-windows-c4bd73d2-31d7-761e-0178-11268bb10392#bkmk_easy

就我而言,Windows 更新破坏了我新鲜的 Win7 SP1 x86 评估版 downloaded from microsoft.com

对我有用的是:

  • 下载 Easy Fix 以启用 TLS 1.2
  • 下载并安装 .Net Framework 4.8(任何 4.x 都可以)
  • 下载 chocolatey nuget 文件,重命名为 .zip,解压并 运行 tools\chocolateyInstall.ps1 as described in choco docs
  • 此时 choco 已安装,但 PowerShell 仍然是 2.x,所以 运行 choco install powershell 得到 5.1