编程知识 cdmana.com

在windows上安装 chocolatey.1.1.0.nupkg

这几天外网特别不稳定,感觉都快没法编程了。正好昨天又新装了一个操作系统,一大堆软件等着要装。所以本来是个挺顺利的事,非得折腾一圈才能成功。

首先是,官方已经说明了如何安装choco,

https://chocolatey.org/install

根据官方的说法,先要执行
Set-ExecutionPolicy AllSigned

或者
Set-ExecutionPolicy Bypass -Scope Process 

然后再执行下面这个指令就可以了,

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

 但由于网络不行,试了几次不能成功,在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://community.chocolatey.org/install.ps1'))
Forcing web requests to allow TLS v1.2 (Required for requests to Chocolatey.org)
Getting latest version of the Chocolatey package for download.
Not using proxy.
Getting Chocolatey from https://community.chocolatey.org/api/v2/package/chocolatey/1.1.0.
Downloading https://community.chocolatey.org/api/v2/package/chocolatey/1.1.0 to C:\Users\user\AppData\Local\Temp\chocolatey\chocoInstall\chocolatey.zip
Not using proxy.

 于是到官网下载,

https://community.chocolatey.org/api/v2/package/chocolatey/1.1.0.

下载完后根据上面的信息把这个文件放在这里,

 C:\Users\user\AppData\Local\Temp\chocolatey\chocoInstall\chocolatey.1.1.0.nupkg

注意这里我把文件要更改成chocolatey.zip(如果不修改的话好像也是没有问题), 然后在Powershell中把前面那条长长的指令重新跑了次,就成功安装了chocolatey。

安装 过程中给出了一长串的信息,留在下面作个备注吧,

Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'))
Forcing web requests to allow TLS v1.2 (Required for requests to Chocolatey.org)
Getting latest version of the Chocolatey package for download.
Not using proxy.
Getting Chocolatey from https://community.chocolatey.org/api/v2/package/chocolatey/1.1.0.
Downloading https://community.chocolatey.org/api/v2/package/chocolatey/1.1.0 to C:\Users\User\AppData\Local\Temp\chocolatey\chocoInstall\chocolatey.zip
Not using proxy.
Extracting C:\Users\USer\AppData\Local\Temp\chocolatey\chocoInstall\chocolatey.zip to C:\Users\User\AppData\Local\Temp\chocolatey\chocoInstall
Installing Chocolatey on the local machine
Creating ChocolateyInstall as an environment variable (targeting 'Machine')
  Setting ChocolateyInstall to 'C:\ProgramData\chocolatey'
WARNING: It's very likely you will need to close and reopen your shell
  before you can use choco.
Restricting write permissions to Administrators
We are setting up the Chocolatey package repository.
The packages themselves go to 'C:\ProgramData\chocolatey\lib'
  (i.e. C:\ProgramData\chocolatey\lib\yourPackageName).
A shim file for the command line goes to 'C:\ProgramData\chocolatey\bin'
  and points to an executable in 'C:\ProgramData\chocolatey\lib\yourPackageName'.

Creating Chocolatey folders if they do not already exist.

WARNING: You can safely ignore errors related to missing log files when
  upgrading from a version of Chocolatey less than 0.9.9.
  'Batch file could not be found' is also safe to ignore.
  'The system cannot find the file specified' - also safe.
chocolatey.nupkg file not installed in lib.
 Attempting to locate it from bootstrapper.
PATH environment variable does not have C:\ProgramData\chocolatey\bin in it. Adding...
警告: Not setting tab completion: Profile file does not exist at 'C:\Users\User\Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1'.
Chocolatey (choco.exe) is now ready.
You can call choco from anywhere, command line or powershell by typing choco.
Run choco /? for a list of functions.
You may need to shut down and restart powershell and/or consoles
 first prior to using choco.
Ensuring Chocolatey commands are on the path
Ensuring chocolatey.nupkg is in the lib folder

安装完成后,可执行文件的路径在这里,

C:\ProgramData\chocolatey\bin 

可以检查一下是否已经添加到系统 环境变量中了 ,如果没有的话,可能安装过程中出了问题,需要手动设置一下即可。

本文结束。

版权声明
本文为[高精度计算机视觉]所创,转载请带上原文链接,感谢
https://spacevision.blog.csdn.net/article/details/126187110

Scroll to Top