<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:media="http://search.yahoo.com/mrss/"><channel><title>开发环境 on Bless Blog</title><link>https://blog.hieros.me/zh/tags/%E5%BC%80%E5%8F%91%E7%8E%AF%E5%A2%83/</link><description>Recent content in 开发环境 on Bless Blog</description><generator>Hugo -- 0.166.0</generator><language>zh</language><lastBuildDate>Wed, 03 Jun 2026 12:00:00 +0800</lastBuildDate><atom:link href="https://blog.hieros.me/zh/tags/%E5%BC%80%E5%8F%91%E7%8E%AF%E5%A2%83/index.xml" rel="self" type="application/rss+xml"/><item><title>Windows 软件管理方案分享</title><link>https://blog.hieros.me/zh/posts/package-managers/</link><pubDate>Wed, 03 Jun 2026 12:00:00 +0800</pubDate><author>BLESS</author><guid>https://blog.hieros.me/zh/posts/package-managers/</guid><description>聊聊本机的 Windows 软件管理思路，八个包管理器各司其职，再加上游戏平台和兜底目录</description><content type="text/html" mode="escaped"><![CDATA[<h1 id="windows-软件管理方案分享">Windows 软件管理方案分享<a href="#windows-%e8%bd%af%e4%bb%b6%e7%ae%a1%e7%90%86%e6%96%b9%e6%a1%88%e5%88%86%e4%ba%ab" class="anchor" aria-hidden="true"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"
      stroke-linecap="round" stroke-linejoin="round" class="feather">
      <path d="M15 7h3a5 5 0 0 1 5 5 5 5 0 0 1-5 5h-3m-6 0H6a5 5 0 0 1-5-5 5 5 0 0 1 5-5h3"></path>
      <line x1="8" y1="12" x2="16" y2="12"></line>
   </svg></a></h1>
<p>最近整理了一下 <code>updateall.ps1</code>，发现本机跑着八个包管理器，趁机把整体的软件管理思路梳理一下，不只是开发工具，也包括游戏和其他日常软件，免得以后搞混了装到错地方。</p>
<hr>
<h2 id="系统级">系统级<a href="#%e7%b3%bb%e7%bb%9f%e7%ba%a7" class="anchor" aria-hidden="true"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"
      stroke-linecap="round" stroke-linejoin="round" class="feather">
      <path d="M15 7h3a5 5 0 0 1 5 5 5 5 0 0 1-5 5h-3m-6 0H6a5 5 0 0 1-5-5 5 5 0 0 1 5-5h3"></path>
      <line x1="8" y1="12" x2="16" y2="12"></line>
   </svg></a></h2>
<h3 id="scoop">Scoop<a href="#scoop" class="anchor" aria-hidden="true"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"
      stroke-linecap="round" stroke-linejoin="round" class="feather">
      <path d="M15 7h3a5 5 0 0 1 5 5 5 5 0 0 1-5 5h-3m-6 0H6a5 5 0 0 1-5-5 5 5 0 0 1 5-5h3"></path>
      <line x1="8" y1="12" x2="16" y2="12"></line>
   </svg></a></h3>
<p>用了很久，体验最好的 Windows 包管理器，主要覆盖跨平台的命令行工具和开发工具链。最满意的地方是软件源的质量，很多在 Linux 上用惯的工具在 Scoop 里都能直接装到，比如 helix、yazi、git、btop、fzf、ripgrep、eza、zoxide、fd、jq……现在本机装了七十多个包，日常用到的命令行工具基本都在这里。</p>
<p>所有东西装在 <code>~/scoop/apps/</code>，完全不需要管理员权限，用 shims 挂到 PATH，卸载也干净，不会留下注册表残留。<code>nerd-fonts</code> bucket 管字体也很方便，FiraCode NF 和 Sarasa Gothic 都是从这里装的。</p>
<p>另外 winget 在 Windows 10 的低版本上可能没有预装，这时候可以直接用 Scoop 来装或者更新 winget 本身，算是 Scoop 作为基础设施的一个体现。</p>
<p>因为很多工具本身也是通过 Scoop 装的，所以更新脚本里 Scoop 必须单独跑在最前面，等它完成之后再并行更新其他东西。</p>
<h3 id="winget">winget<a href="#winget" class="anchor" aria-hidden="true"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"
      stroke-linecap="round" stroke-linejoin="round" class="feather">
      <path d="M15 7h3a5 5 0 0 1 5 5 5 5 0 0 1-5 5h-3m-6 0H6a5 5 0 0 1-5-5 5 5 0 0 1 5-5h3"></path>
      <line x1="8" y1="12" x2="16" y2="12"></line>
   </svg></a></h3>
<p>微软官方出的，侧重于专供 Windows 的桌面应用和商业软件，这类东西在 Scoop 里基本找不到。包库来自 winget-pkgs 社区仓库，走官方渠道相对可信。</p>
<p><code>winget upgrade --all</code> 是我觉得最实用的功能，系统里装的软件一条命令全部更新，比手动挨个去官网下安装包省心太多。还有 <code>winget export</code> 可以导出当前安装的所有软件列表，换新机的时候 <code>winget import</code> 一次性恢复，算是一个不错的迁移方案。</p>
<p>分工上比较清晰：命令行开发工具走 Scoop，Windows 桌面应用走 winget，两者重叠的情况不多。</p>
<h3 id="chocolatey">Chocolatey<a href="#chocolatey" class="anchor" aria-hidden="true"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"
      stroke-linecap="round" stroke-linejoin="round" class="feather">
      <path d="M15 7h3a5 5 0 0 1 5 5 5 5 0 0 1-5 5h-3m-6 0H6a5 5 0 0 1-5-5 5 5 0 0 1 5-5h3"></path>
      <line x1="8" y1="12" x2="16" y2="12"></line>
   </svg></a></h3>
<p>本机的 Chocolatey 是通过 winget 装的，包库是三个里最大的，但维护质量参差不齐，而且基本都需要管理员权限。目前实际只用它装了一个东西：MSVC，Scoop 和 winget 都没收录，choco 的 <code>visualstudio2022buildtools</code> 包正好能覆盖这个需求。说白了就是为了这一个用途存在的。</p>
<h3 id="msys2">MSYS2<a href="#msys2" class="anchor" aria-hidden="true"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"
      stroke-linecap="round" stroke-linejoin="round" class="feather">
      <path d="M15 7h3a5 5 0 0 1 5 5 5 5 0 0 1-5 5h-3m-6 0H6a5 5 0 0 1-5-5 5 5 0 0 1 5-5h3"></path>
      <line x1="8" y1="12" x2="16" y2="12"></line>
   </svg></a></h3>
<p>性质上和上面三个不太一样，MSYS2 提供的是一套完整的类 Unix 环境，内置 pacman 包管理器。在 Windows 上编译 C/C++ 项目或者需要 gcc、make、cmake 这类 GNU 工具的时候，MSYS2 是绕不开的选择。Git for Windows 底层用的也是这套环境。</p>
<p>更新时有个小细节，pacman 需要跑两遍：第一遍 <code>-Syyu</code> 强制刷新数据库同时升级 pacman 自身，第二遍 <code>-Syu</code> 才升级其余包。跑一遍有时候会漏掉东西，这个是 pacman 的设计，不是 bug。</p>
<p>MSYS2 提供了 MSYS2、MinGW-w64、UCRT64 几套不同的子系统，底层 ABI 不一样，和 Windows 原生工具链的互操作性也有区别，具体选哪个看项目需求，一般来说现代项目推荐 UCRT64。</p>
<h3 id="游戏平台">游戏平台<a href="#%e6%b8%b8%e6%88%8f%e5%b9%b3%e5%8f%b0" class="anchor" aria-hidden="true"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"
      stroke-linecap="round" stroke-linejoin="round" class="feather">
      <path d="M15 7h3a5 5 0 0 1 5 5 5 5 0 0 1-5 5h-3m-6 0H6a5 5 0 0 1-5-5 5 5 0 0 1 5-5h3"></path>
      <line x1="8" y1="12" x2="16" y2="12"></line>
   </svg></a></h3>
<p>游戏统一交给官方平台管理：Steam、Epic、GOG、Battle.net，各家自己维护更新，不走任何包管理器。这类软件本来就是平台强绑定的，没必要强行纳入 Scoop 或 winget 管理，官方渠道反而最省心。</p>
<h3 id="兜底固定安装目录">兜底：固定安装目录<a href="#%e5%85%9c%e5%ba%95%e5%9b%ba%e5%ae%9a%e5%ae%89%e8%a3%85%e7%9b%ae%e5%bd%95" class="anchor" aria-hidden="true"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"
      stroke-linecap="round" stroke-linejoin="round" class="feather">
      <path d="M15 7h3a5 5 0 0 1 5 5 5 5 0 0 1-5 5h-3m-6 0H6a5 5 0 0 1-5-5 5 5 0 0 1 5-5h3"></path>
      <line x1="8" y1="12" x2="16" y2="12"></line>
   </svg></a></h3>
<p>不在以上任何包管理器覆盖范围内的软件，统一安装到一个固定目录。这样不管过了多久，想找某个软件装在哪直接去那个目录翻，不用靠记忆，也不会在 C 盘到处散落。</p>
<hr>
<h2 id="python">Python<a href="#python" class="anchor" aria-hidden="true"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"
      stroke-linecap="round" stroke-linejoin="round" class="feather">
      <path d="M15 7h3a5 5 0 0 1 5 5 5 5 0 0 1-5 5h-3m-6 0H6a5 5 0 0 1-5-5 5 5 0 0 1 5-5h3"></path>
      <line x1="8" y1="12" x2="16" y2="12"></line>
   </svg></a></h2>
<h3 id="uv">uv<a href="#uv" class="anchor" aria-hidden="true"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"
      stroke-linecap="round" stroke-linejoin="round" class="feather">
      <path d="M15 7h3a5 5 0 0 1 5 5 5 5 0 0 1-5 5h-3m-6 0H6a5 5 0 0 1-5-5 5 5 0 0 1 5-5h3"></path>
      <line x1="8" y1="12" x2="16" y2="12"></line>
   </svg></a></h3>
<p>Rust 写的，速度比 pip 快 10-100 倍，本机所有 Python 项目现在全走 uv 管理。之前同时在用 pip、venv、pyenv、pipx，现在一个 uv 全替代了，少维护好几套工具。</p>
<p><code>uv run</code> 是我觉得体验提升最大的地方，不需要先 <code>source .venv/bin/activate</code> 激活虚拟环境，直接 <code>uv run python script.py</code> 就能在正确的环境里运行，少了很多上下文切换的心智负担。</p>
<p><code>uv tool</code> 这个子命令值得单独说一下。有一类 Python 工具，官方文档推荐的安装方式是 <code>pip install</code>，但它们又不属于某个具体项目的依赖，需要全局可用——Scoop 里能找到的（比如 ruff）还是走 Scoop，但 Scoop 没有收录的就用 <code>uv tool install</code> 来管。</p>
<p>每个工具装在各自独立的虚拟环境里，入口暴露到 PATH，依赖完全隔离，不会互相污染，也不会搅乱项目环境。这和直接 <code>pip install --user</code> 装到全局 site-packages 的区别很大，后者各工具依赖混在一起，迟早出冲突。</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"><code class="language-bash" data-lang="bash"><span style="display:flex;"><span>uv tool install &lt;package&gt;     <span style="color:#75715e"># 安装</span>
</span></span><span style="display:flex;"><span>uv tool upgrade --all         <span style="color:#75715e"># 一次性升级所有工具</span>
</span></span><span style="display:flex;"><span>uv tool list                  <span style="color:#75715e"># 查看已安装的工具</span>
</span></span></code></pre></div><hr>
<h2 id="多语言运行时">多语言运行时<a href="#%e5%a4%9a%e8%af%ad%e8%a8%80%e8%bf%90%e8%a1%8c%e6%97%b6" class="anchor" aria-hidden="true"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"
      stroke-linecap="round" stroke-linejoin="round" class="feather">
      <path d="M15 7h3a5 5 0 0 1 5 5 5 5 0 0 1-5 5h-3m-6 0H6a5 5 0 0 1-5-5 5 5 0 0 1 5-5h3"></path>
      <line x1="8" y1="12" x2="16" y2="12"></line>
   </svg></a></h2>
<h3 id="mise">mise<a href="#mise" class="anchor" aria-hidden="true"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"
      stroke-linecap="round" stroke-linejoin="round" class="feather">
      <path d="M15 7h3a5 5 0 0 1 5 5 5 5 0 0 1-5 5h-3m-6 0H6a5 5 0 0 1-5-5 5 5 0 0 1 5-5h3"></path>
      <line x1="8" y1="12" x2="16" y2="12"></line>
   </svg></a></h3>
<p>mise 是运行时版本管理器，asdf 的 Rust 重写，原来叫 rtx。理论上能管很多语言的运行时，但本机实际上只用它做一件事：管理 Node.js 版本和全局 npm 包。Python 那边完全交给 uv，不需要 mise 插手。</p>
<p>最省心的地方是 shell hook，进入项目目录会自动读 <code>.mise.toml</code> 切换到对应 Node.js 版本，不需要手动激活。全局 npm 包（比如一些前端 CLI 工具）也通过 mise 统一管理，<code>mise upgrade</code> 一起更新。</p>
<hr>
<h2 id="latex">LaTeX<a href="#latex" class="anchor" aria-hidden="true"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"
      stroke-linecap="round" stroke-linejoin="round" class="feather">
      <path d="M15 7h3a5 5 0 0 1 5 5 5 5 0 0 1-5 5h-3m-6 0H6a5 5 0 0 1-5-5 5 5 0 0 1 5-5h3"></path>
      <line x1="8" y1="12" x2="16" y2="12"></line>
   </svg></a></h2>
<h3 id="miktex">MiKTeX<a href="#miktex" class="anchor" aria-hidden="true"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"
      stroke-linecap="round" stroke-linejoin="round" class="feather">
      <path d="M15 7h3a5 5 0 0 1 5 5 5 5 0 0 1-5 5h-3m-6 0H6a5 5 0 0 1-5-5 5 5 0 0 1 5-5h3"></path>
      <line x1="8" y1="12" x2="16" y2="12"></line>
   </svg></a></h3>
<p>MiKTeX 是 Windows 上最常用的 LaTeX 发行版，包管理走内置的 <code>mpm</code>（MiKTeX Package Manager）。它的按需安装设计我挺喜欢：第一次编译遇到缺失宏包会自动下载，不需要提前把几个 GB 的包全装上，初装体积小很多。</p>
<p>批量更新用 <code>miktex packages update</code>，也有 MiKTeX Console 这个 GUI 工具，但我基本只在命令行里操作。</p>
<hr>
<h2 id="rust-工具链">Rust 工具链<a href="#rust-%e5%b7%a5%e5%85%b7%e9%93%be" class="anchor" aria-hidden="true"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"
      stroke-linecap="round" stroke-linejoin="round" class="feather">
      <path d="M15 7h3a5 5 0 0 1 5 5 5 5 0 0 1-5 5h-3m-6 0H6a5 5 0 0 1-5-5 5 5 0 0 1 5-5h3"></path>
      <line x1="8" y1="12" x2="16" y2="12"></line>
   </svg></a></h2>
<h3 id="rustup">rustup<a href="#rustup" class="anchor" aria-hidden="true"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"
      stroke-linecap="round" stroke-linejoin="round" class="feather">
      <path d="M15 7h3a5 5 0 0 1 5 5 5 5 0 0 1-5 5h-3m-6 0H6a5 5 0 0 1-5-5 5 5 0 0 1 5-5h3"></path>
      <line x1="8" y1="12" x2="16" y2="12"></line>
   </svg></a></h3>
<p>Rust 官方的工具链管理器，安装和更新 Rust 本身就靠它，没有替代品。<code>rustup update</code> 把所有已安装的 toolchain 更新到最新，非常简单。</p>
<p>rustup 还管 stable/beta/nightly 多版本并存，通过项目根目录的 <code>rust-toolchain.toml</code> 可以声明这个项目用哪个 channel，进去就自动切换，和 mise 的设计思路类似。跨平台编译也靠 <code>rustup target add</code> 来管理 target。</p>
<hr>
<h2 id="小结">小结<a href="#%e5%b0%8f%e7%bb%93" class="anchor" aria-hidden="true"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"
      stroke-linecap="round" stroke-linejoin="round" class="feather">
      <path d="M15 7h3a5 5 0 0 1 5 5 5 5 0 0 1-5 5h-3m-6 0H6a5 5 0 0 1-5-5 5 5 0 0 1 5-5h3"></path>
      <line x1="8" y1="12" x2="16" y2="12"></line>
   </svg></a></h2>
<p>八个工具，一张表理清楚：</p>
<table>
	<thead>
			<tr>
					<th>包管理器</th>
					<th>覆盖范围</th>
					<th>更新命令</th>
			</tr>
	</thead>
	<tbody>
			<tr>
					<td>Scoop</td>
					<td>Windows CLI 工具</td>
					<td><code>scoop update *</code></td>
			</tr>
			<tr>
					<td>winget</td>
					<td>Windows 桌面软件</td>
					<td><code>winget upgrade --all</code></td>
			</tr>
			<tr>
					<td>Chocolatey</td>
					<td>老旧/企业 Windows 软件</td>
					<td><code>sudo choco upgrade all -y</code></td>
			</tr>
			<tr>
					<td>MSYS2 / pacman</td>
					<td>Unix 工具链、MinGW 编译器</td>
					<td><code>pacman -Syyu &amp;&amp; pacman -Syu</code></td>
			</tr>
			<tr>
					<td>uv</td>
					<td>Python 项目/工具/解释器</td>
					<td><code>uv tool upgrade --all</code></td>
			</tr>
			<tr>
					<td>mise</td>
					<td>Node.js 版本 + 全局 npm 包</td>
					<td><code>mise upgrade</code></td>
			</tr>
			<tr>
					<td>MiKTeX / mpm</td>
					<td>LaTeX 宏包</td>
					<td><code>miktex packages update</code></td>
			</tr>
			<tr>
					<td>rustup</td>
					<td>Rust 工具链</td>
					<td><code>rustup update</code></td>
			</tr>
	</tbody>
</table>
<p><code>updateall.ps1</code> 里 Scoop 单独串行跑完，其余七个并行，整体更新一次大概几分钟，比以前挨个手动执行省了不少时间。</p>
]]></content></item></channel></rss>