scoop——强大的Windows命令行包管理工具

时间:2020-03-24
本文章向大家介绍scoop——强大的Windows命令行包管理工具,主要包括scoop——强大的Windows命令行包管理工具使用实例、应用技巧、基本知识点总结和需要注意事项,具有一定的参考价值,需要的朋友可以参考一下。

Scoop

强大的Windows软件管理器

scoop 是一个优秀windows命令行安装工具

若需了解更多, 请前往 Github 获取更多使用方式

Features:


Scoop可以从命令行以最小的负担安装程序。它试图消除类似的东西:

  • 权限弹出窗口
  • GUI向导样式的安装程序'
  • 安装大量程序造成的路径污染
  • 安装和卸载程序产生的意外副作用
  • 查找和安装依赖项的需求
  • 需要执行额外的设置步骤才能获得有效的程序

Scoop拥有很好的脚本编写性,因此可以运行可重复的设置以自己喜欢的方式获取环境.

Requirements:


  • Windows 7 SP1+ / Windows Server 2008+
  • PowerShell 5 (or later, include PowerShell Core) and .NET Framework 4.5 (or later)
  • PowerShell must be enabled for your user account e.g. Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser

 安装完成后, 执行scoop help获取更多使用方法介绍

Installation:


  在 PowerShell 中输入下面内容,保证允许本地脚本的执行:

Set-ExecutionPolicy RemoteSigned -scope CurrentUser

  然后执行下面的命令以在默认位置(C:\Users\<user>\scoop)安装 Scoop:

iex (new-object net.webclient).downloadstring('https://get.scoop.sh')

  如若想临时安装在自定义路径,需要执行以下命令改变环境后再安装scoop.

$env:SCOOP='D:\Applications\Scoop'
[Environment]::SetEnvironmentVariable('SCOOP', $env:SCOOP, 'User')

  如若想永久安装在自定义路径,需要执行以下命令改变环境后再安装scoop. 

$env:SCOOP_GLOBAL='D:\Applications\Scoop' 
[Environment]::SetEnvironmentVariable('SCOOP_GLOBAL', $env:SCOOP_GLOBAL, 'Machine')

添加更多Bucket:


Scoop 有许多优秀的Bucket,你可以通过运行scoop bucket known来获取官方支持的bucket:

  • main - Default bucket for the most common (mostly CLI) apps
  • extras - Apps that don't fit the main bucket's criteria
  • games - Open source/freeware games and game-related tools
  • java - Installers for Oracle Java, OpenJDK, Zulu, ojdkbuild, AdoptOpenJDK, Amazon Corretto, BellSoft Liberica & SapMachine
  • jetbrains - Installers for all JetBrains utilities and IDEs
  • php - Installers for most versions of PHP
  • versions - Alternative versions of apps found in other buckets

添加方法

scoop bucket add <bucketname>

  也可以前往社区( Scoop Directory.)获取更多优秀第三方bucket

eg.
# 以官方Bucket, Extra的安装方法如下: scoop bucket add extra # 以社区维护的bucket. dorado的安装方法如下: scoop bucket add dorado https://github.com/h404bi/dorado

进阶操作


你可以前往 Creating your own bucket 获取创建自己的bucket,并在社区中发布.

ISSUE


  • 若安装scoop过程失败,或速度过慢,请尝试在允许访问某404网站的情况下如下调试后重试

# 临时允许powershell流量走http通道
set http_proxy=http://127.0.0.1:port set https_proxy=http://127.0.0.1:port

# 或 编辑 C:\Users\<user>\Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1 添加以下内容使powershell保持走HTTP通道流量

$env:http_proxy='http://127.0.0.1:port'
$env:https_proxy='http://127.0.0.1:port'

  • 若在Windows更新完成后丢失scoop,请前往Github Pages获取current,并置入 (C:\Users\<user>\scoop\apps\scoop\) , 再通过powershell执行scoop reset恢复使用
  • scoop安装过程失败务必前往 C:\Users\<user>\ 下将scoop删除
  • 安装软件过程中因为网络问题取消了安装,请先执行 scoop uninstall <application> 完成卸载动作,然后才能重新执行安装

使用帮助


以安装Python为例,powershell 执行scoop search python,检索scoop已添加bucket中是否有Python

然后 执行 scoop install python 获取安装.也可以通过执行 scoop install python@3.6.8 安装指定Python版本

原文地址:https://www.cnblogs.com/XL-Lee/p/12558344.html