<rss xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title>Wlcheng's Life</title><link>https://wlcheng.cc/</link><description>来日方长，何惧车遥马慢</description><generator>Hugo -- gohugo.io</generator><language>zh-CN</language><managingEditor>wlcheng12@outlook.com (wlcheng)</managingEditor><webMaster>wlcheng12@outlook.com (wlcheng)</webMaster><lastBuildDate>Sat, 02 Aug 2025 09:37:42 +0800</lastBuildDate><atom:link href="https://wlcheng.cc/index.xml" rel="self" type="application/rss+xml"/><item><title>Git 常用命令和用法</title><link>https://wlcheng.cc/posts/git_command_list/</link><pubDate>Sun, 08 Jun 2025 11:26:27 +0100</pubDate><author><name>wlcheng</name></author><guid>https://wlcheng.cc/posts/git_command_list/</guid><description><![CDATA[<p>速查 Git 常用的命令和用法。分为基本（commit、branch、checkout、merge、rabase 等）和远程（clone、push、pull 等）两部分。</p>
<p>本文基于 <a href="https://chat.openai.com/chat" target="_blank" rel="noopener noreferrer">chatGPT</a> 自动生成初稿（省时省力😁），并参考 <a href="https://learngitbranching.js.org/?locale=zh_CN" target="_blank" rel="noopener noreferrer">learngitbranching</a> 进行调整。</p>
<h2 id="基本命令" class="headerLink">
    <a href="#%e5%9f%ba%e6%9c%ac%e5%91%bd%e4%bb%a4" class="header-mark"></a>基本命令</h2><p><code>git init</code>：创建一个新的 Git 仓库。</p>
<p><code>git add [file]</code>：将文件添加到 Git 的暂存区。</p>
<p><code>git commit -m [message]</code>：将暂存区的文件提交到 Git 仓库，并添加一条注释。</p>
<p><code>git status</code>：查看当前 Git 仓库的状态，包括已修改、已暂存和未跟踪的文件。</p>
<p><code>git diff</code>：查看未暂存文件和最后一次提交之间的差异。</p>
<p><code>git diff --staged</code>：查看已暂存文件和最后一次提交之间的差异。</p>
<p><code>git log</code>：查看 Git 仓库的提交历史。</p>
<p><code>git reflog</code>：查看命令历史，即分支的所有操作记录。</p>
<p><code>git tag [name]</code>：给当前的提交打上标签。</p>
<p><code>git reset</code>：取消暂存或取消上一次提交。</p>
<p><code>git rm [file]</code>：从 Git 仓库中删除文件。</p>
<h2 id="分支相关" class="headerLink">
    <a href="#%e5%88%86%e6%94%af%e7%9b%b8%e5%85%b3" class="header-mark"></a>分支相关</h2><p><code>git branch [name]</code>：创建一个新的分支。</p>
<p><code>git branch -d[D] [name]</code>：删除[强制删除]一个分支。</p>
<p><code>git checkout [branch-name]</code>：切换到另一个分支。</p>
<p><code>git checkout -b [branch-name]</code>：创建同时切换到另一个分支。</p>
<p><code>git merge [branch]</code>：将指定的分支合并到当前分支。</p>
<p><code>git rebase [branch]</code>：将当前分支的提交步骤顺接到指定分支。</p>
<h2 id="远程相关" class="headerLink">
    <a href="#%e8%bf%9c%e7%a8%8b%e7%9b%b8%e5%85%b3" class="header-mark"></a>远程相关</h2><p><code>git clone [url]</code>：从远程仓库克隆一个副本到本地。</p>
<p><code>git pull</code>：从远程仓库拉取最新的代码到本地。</p>
<p><code>git push [origin] [master]</code>：将本地 master 分支推送到远程仓库。</p>
<p><code>git remote -[v]</code> 查看远程仓库[详细]信息。</p>
<p><code>git remote add [name] [url]</code>：将远程仓库添加到 Git 仓库。</p>
<p><code>git fetch</code>：从远程仓库获取最新的代码，但不进行合并。先<code>fetch</code>，再<code>merge</code>就相当于<code>pull</code>。</p>
<h2 id="其他" class="headerLink">
    <a href="#%e5%85%b6%e4%bb%96" class="header-mark"></a>其他</h2><p><code>HEAD</code>：指向当前正在处理的提交记录。</p>
<p><code>C^[number]</code>：表示指向提交记录 <code>C</code> 的第 <code>number</code> 个直接父记录（宽度搜索）。一个记录可能会有多个父记录（执行 <code>merge</code> 时产生）。<code>C^</code> 和 <code>C^1</code> 等价；<code>number</code>大于 1 时表示指向其他父记录。</p>
<p><code>C~[number]</code>：表示指向提交记录 <code>C</code> 的回溯第 <code>number</code> 代的祖先记录（深度搜索）。</p>
<h2 id="参考" class="headerLink">
    <a href="#%e5%8f%82%e8%80%83" class="header-mark"></a>参考</h2><ul>
<li>[1] Peter Cottle. learngitbranching. <a href="https://learngitbranching.js.org/?locale=zh_CN" target="_blank" rel="noopener noreferrer">https://learngitbranching.js.org/?locale=zh_CN</a></li>
<li>[2] GitHub Docs. Git Cheat Sheets. <a href="https://training.github.com/downloads/zh_CN/github-git-cheat-sheet/" target="_blank" rel="noopener noreferrer">https://training.github.com/downloads/zh_CN/github-git-cheat-sheet/</a></li>
<li>[3] Visual Git Cheat Sheet. <a href="https://ndpsoftware.com/git-cheatsheet.html" target="_blank" rel="noopener noreferrer">https://ndpsoftware.com/git-cheatsheet.html</a></li>
<li>[4] Blue Stragglers. 一个有趣的 Git 练习网站. <a href="https://zhuanlan.zhihu.com/p/383960650" target="_blank" rel="noopener noreferrer">https://zhuanlan.zhihu.com/p/383960650</a></li>
</ul>
<h1 id="更多-git-知识和用法" class="headerLink">
    <a href="#%e6%9b%b4%e5%a4%9a-git-%e7%9f%a5%e8%af%86%e5%92%8c%e7%94%a8%e6%b3%95" class="header-mark"></a>更多 git 知识和用法</h1><h2 id="git-本地仓库文件夹结构" class="headerLink">
    <a href="#git-%e6%9c%ac%e5%9c%b0%e4%bb%93%e5%ba%93%e6%96%87%e4%bb%b6%e5%a4%b9%e7%bb%93%e6%9e%84" class="header-mark"></a>git 本地仓库文件夹结构</h2><p>在 git repo 文件夹下，命令行执行 <code>git init</code> 初始化后，会生成一个 .git 文件夹，里面包含以下内容：</p>
<ul>
<li>.git/HEAD：指向当前分支</li>
<li>.git/config：配置文件</li>
<li>.git/description：描述文件</li>
<li>.git/index：索引文件</li>
<li>.git/hooks/：钩子脚本</li>
<li>.git/info/：包含全局忽略文件</li>
<li>.git/objects/：存储对象（commit、tree、blob）</li>
<li>.git/refs/：存储引用（branch、tag）</li>
<li>.git/logs/：存储提交日志</li>
</ul>
<p>一般来说，<code>.git</code> 文件夹自动隐藏了，Power Shell 可以通过 <code>ls -Hidden</code> 命令查看。</p>
<h2 id="git-中的一些概念" class="headerLink">
    <a href="#git-%e4%b8%ad%e7%9a%84%e4%b8%80%e4%ba%9b%e6%a6%82%e5%bf%b5" class="header-mark"></a>git 中的一些概念</h2><h3 id="对象名词" class="headerLink">
    <a href="#%e5%af%b9%e8%b1%a1%e5%90%8d%e8%af%8d" class="header-mark"></a>对象（名词）</h3><ul>
<li><code>commit</code>：提交，每次提交都会生成一个 commit id，commit id 是一个 40 位的哈希值，用来唯一标识一个 commit。</li>
<li><code>tree</code>：树，每个 commit 都有一个 tree，用来存储该 commit 修改的文件和目录结构。</li>
<li><code>blob</code>：块，每个文件都会被存储为一个 blob，用来存储文件的内容。</li>
<li><code>branch</code>：分支，每个分支都有一个指向最新的 commit 的指针。</li>
<li><code>tag</code>：标签，用来标记某个 commit，通常用来标记 release 版本。</li>
<li><code>HEAD</code>：当前分支的指针，指向当前分支的最新 commit。</li>
<li><code>index</code>：索引，用来存储暂存区的文件。</li>
<li><code>remote</code>：远程仓库，用来存储远程的 git 仓库。</li>
</ul>
<h3 id="origin-远程仓库别名" class="headerLink">
    <a href="#origin-%e8%bf%9c%e7%a8%8b%e4%bb%93%e5%ba%93%e5%88%ab%e5%90%8d" class="header-mark"></a><code>origin</code> 远程仓库别名</h3><ul>
<li><code>origin</code>：远程仓库的别名，通常用来表示远程仓库。可以把它看作是远程仓库的“默认地址”。
在 Git 中，<code>origin</code> 是一个默认的远程仓库名称，它通常指向你克隆时指定的远程仓库。简单来说，<code>origin</code> 代表远程仓库的默认别名。你可以把它看作是远程仓库的“默认地址”。</li>
</ul>
<ol>
<li>
<p><strong>默认远程仓库名称</strong>：</p>
<ul>
<li>当你克隆一个仓库时，Git 会自动把源仓库的 URL 赋给一个默认的远程名称 <code>origin</code>。</li>
<li>例如，执行 <code>git clone https://github.com/user/repo.git</code> 后，<code>origin</code> 就会指向该 URL。</li>
</ul>
</li>
<li>
<p><strong>查看远程仓库地址</strong>：</p>
<ul>
<li>
<p>你可以通过以下命令查看 <code>origin</code>（以及其他远程仓库）的 URL：</p>
<div class="code-block highlight is-open show-line-numbers  tw-group tw-my-2">
  <div class="
    code-block-title 
    
    tw-flex 
    tw-flex-row 
    tw-justify-between 
    tw-w-full tw-bg-bgColor-secondary
    ">      
    <button 
      class="
        tw-select-none 
        tw-mx-2 
        tw-block
        group-[.is-open]:tw-rotate-90
        tw-transition-[transform] 
        tw-duration-500 
        tw-ease-in-out
        print:!tw-hidden"
      disabled
      aria-hidden="true"><svg class="icon"
    xmlns="http://www.w3.org/2000/svg" viewBox="0 0 320 512"><!-- Font Awesome Free 5.15.4 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) --><path d="M285.476 272.971L91.132 467.314c-9.373 9.373-24.569 9.373-33.941 0l-22.667-22.667c-9.357-9.357-9.375-24.522-.04-33.901L188.505 256 34.484 101.255c-9.335-9.379-9.317-24.544.04-33.901l22.667-22.667c9.373-9.373 24.569-9.373 33.941 0L285.475 239.03c9.373 9.372 9.373 24.568.001 33.941z"/></svg></button>

    <div class="code-block-title-bar tw-w-full">
      <p class="tw-select-none !tw-my-1">bash</p>
    </div>
    <div class="tw-flex">
      <button 
        class="
          line-number-button
          tw-select-none 
          tw-mx-2 
          tw-hidden 
          group-[.is-open]:tw-block 
          group-[.show-line-numbers]:tw-text-fgColor-link 
          print:!tw-hidden" 
        title="Toggle line numbers"><svg class="icon"
    xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><!-- Font Awesome Free 5.15.4 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) --><path d="M61.77 401l17.5-20.15a19.92 19.92 0 0 0 5.07-14.19v-3.31C84.34 356 80.5 352 73 352H16a8 8 0 0 0-8 8v16a8 8 0 0 0 8 8h22.83a157.41 157.41 0 0 0-11 12.31l-5.61 7c-4 5.07-5.25 10.13-2.8 14.88l1.05 1.93c3 5.76 6.29 7.88 12.25 7.88h4.73c10.33 0 15.94 2.44 15.94 9.09 0 4.72-4.2 8.22-14.36 8.22a41.54 41.54 0 0 1-15.47-3.12c-6.49-3.88-11.74-3.5-15.6 3.12l-5.59 9.31c-3.72 6.13-3.19 11.72 2.63 15.94 7.71 4.69 20.38 9.44 37 9.44 34.16 0 48.5-22.75 48.5-44.12-.03-14.38-9.12-29.76-28.73-34.88zM496 224H176a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16h320a16 16 0 0 0 16-16v-32a16 16 0 0 0-16-16zm0-160H176a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16h320a16 16 0 0 0 16-16V80a16 16 0 0 0-16-16zm0 320H176a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16h320a16 16 0 0 0 16-16v-32a16 16 0 0 0-16-16zM16 160h64a8 8 0 0 0 8-8v-16a8 8 0 0 0-8-8H64V40a8 8 0 0 0-8-8H32a8 8 0 0 0-7.14 4.42l-8 16A8 8 0 0 0 24 64h8v64H16a8 8 0 0 0-8 8v16a8 8 0 0 0 8 8zm-3.91 160H80a8 8 0 0 0 8-8v-16a8 8 0 0 0-8-8H41.32c3.29-10.29 48.34-18.68 48.34-56.44 0-29.06-25-39.56-44.47-39.56-21.36 0-33.8 10-40.46 18.75-4.37 5.59-3 10.84 2.8 15.37l8.58 6.88c5.61 4.56 11 2.47 16.12-2.44a13.44 13.44 0 0 1 9.46-3.84c3.33 0 9.28 1.56 9.28 8.75C51 248.19 0 257.31 0 304.59v4C0 316 5.08 320 12.09 320z"/></svg></button>

      <button 
        class="
          wrap-code-button
          tw-select-none 
          tw-mx-2 
          tw-hidden 
          group-[.is-open]:tw-block 
          group-[.is-wrap]:tw-text-fgColor-link 
          print:!tw-hidden" 
        title="Toggle code wrap"><svg class="icon"
    xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><!-- Font Awesome Free 5.15.4 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) --><path d="M16 132h416c8.837 0 16-7.163 16-16V76c0-8.837-7.163-16-16-16H16C7.163 60 0 67.163 0 76v40c0 8.837 7.163 16 16 16zm0 160h416c8.837 0 16-7.163 16-16v-40c0-8.837-7.163-16-16-16H16c-8.837 0-16 7.163-16 16v40c0 8.837 7.163 16 16 16zm0 160h416c8.837 0 16-7.163 16-16v-40c0-8.837-7.163-16-16-16H16c-8.837 0-16 7.163-16 16v40c0 8.837 7.163 16 16 16z"/></svg></button>
      
      <button 
        class="
          copy-code-button
          tw-select-none
          tw-mx-2 
          tw-hidden
          group-[.is-open]:tw-block
          hover:tw-text-fgColor-link 
          print:!tw-hidden"
        title="Copy code">
          <span class="copy-icon tw-block"><svg class="icon"
    xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><!-- Font Awesome Free 5.15.4 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) --><path d="M433.941 65.941l-51.882-51.882A48 48 0 0 0 348.118 0H176c-26.51 0-48 21.49-48 48v48H48c-26.51 0-48 21.49-48 48v320c0 26.51 21.49 48 48 48h224c26.51 0 48-21.49 48-48v-48h80c26.51 0 48-21.49 48-48V99.882a48 48 0 0 0-14.059-33.941zM266 464H54a6 6 0 0 1-6-6V150a6 6 0 0 1 6-6h74v224c0 26.51 21.49 48 48 48h96v42a6 6 0 0 1-6 6zm128-96H182a6 6 0 0 1-6-6V54a6 6 0 0 1 6-6h106v88c0 13.255 10.745 24 24 24h88v202a6 6 0 0 1-6 6zm6-256h-64V48h9.632c1.591 0 3.117.632 4.243 1.757l48.368 48.368a6 6 0 0 1 1.757 4.243V112z"/></svg></span>
          <span class="check-icon tw-hidden"><svg class="icon"
    xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><!-- Font Awesome Free 5.15.4 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) --><path d="M173.898 439.404l-166.4-166.4c-9.997-9.997-9.997-26.206 0-36.204l36.203-36.204c9.997-9.998 26.207-9.998 36.204 0L192 312.69 432.095 72.596c9.997-9.997 26.207-9.997 36.204 0l36.203 36.204c9.997 9.997 9.997 26.206 0 36.204l-294.4 294.401c-9.998 9.997-26.207 9.997-36.204-.001z"/></svg></span>
      </button>
        
      <button 
        class="
          tw-select-none 
          tw-mx-2 
          tw-block 
          group-[.is-open]:tw-hidden 
          print:!tw-hidden" 
        disabled
        aria-hidden="true"><svg class="icon"
    xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><!-- Font Awesome Free 5.15.4 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) --><path d="M328 256c0 39.8-32.2 72-72 72s-72-32.2-72-72 32.2-72 72-72 72 32.2 72 72zm104-72c-39.8 0-72 32.2-72 72s32.2 72 72 72 72-32.2 72-72-32.2-72-72-72zm-352 0c-39.8 0-72 32.2-72 72s32.2 72 72 72 72-32.2 72-72-32.2-72-72-72z"/></svg></button>
    </div>
  </div>
  <pre style="counter-reset: codeblock;" class="tw-block tw-m-0 tw-p-0"><code 
    id="codeblock-id-1" 
    class="
      chroma 
      !tw-block 
      tw-p-0
      tw-m-0
      tw-transition-[max-height] 
      tw-duration-500 
      tw-ease-in-out 
      group-[.is-closed]:!tw-max-h-0 
      group-[.is-wrap]:tw-text-wrap
      tw-overflow-y-hidden
      tw-overflow-x-auto
      tw-scrollbar-thin
      "><span class="line"><span class="cl">git remote -v</span></span></code></pre>
</div>
<p>输出示例：</p>
<div class="code-block highlight is-open show-line-numbers  tw-group tw-my-2">
  <div class="
    code-block-title 
    
    tw-flex 
    tw-flex-row 
    tw-justify-between 
    tw-w-full tw-bg-bgColor-secondary
    ">      
    <button 
      class="
        tw-select-none 
        tw-mx-2 
        tw-block
        group-[.is-open]:tw-rotate-90
        tw-transition-[transform] 
        tw-duration-500 
        tw-ease-in-out
        print:!tw-hidden"
      disabled
      aria-hidden="true"><svg class="icon"
    xmlns="http://www.w3.org/2000/svg" viewBox="0 0 320 512"><!-- Font Awesome Free 5.15.4 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) --><path d="M285.476 272.971L91.132 467.314c-9.373 9.373-24.569 9.373-33.941 0l-22.667-22.667c-9.357-9.357-9.375-24.522-.04-33.901L188.505 256 34.484 101.255c-9.335-9.379-9.317-24.544.04-33.901l22.667-22.667c9.373-9.373 24.569-9.373 33.941 0L285.475 239.03c9.373 9.372 9.373 24.568.001 33.941z"/></svg></button>

    <div class="code-block-title-bar tw-w-full">
      <p class="tw-select-none !tw-my-1">bash</p>
    </div>
    <div class="tw-flex">
      <button 
        class="
          line-number-button
          tw-select-none 
          tw-mx-2 
          tw-hidden 
          group-[.is-open]:tw-block 
          group-[.show-line-numbers]:tw-text-fgColor-link 
          print:!tw-hidden" 
        title="Toggle line numbers"><svg class="icon"
    xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><!-- Font Awesome Free 5.15.4 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) --><path d="M61.77 401l17.5-20.15a19.92 19.92 0 0 0 5.07-14.19v-3.31C84.34 356 80.5 352 73 352H16a8 8 0 0 0-8 8v16a8 8 0 0 0 8 8h22.83a157.41 157.41 0 0 0-11 12.31l-5.61 7c-4 5.07-5.25 10.13-2.8 14.88l1.05 1.93c3 5.76 6.29 7.88 12.25 7.88h4.73c10.33 0 15.94 2.44 15.94 9.09 0 4.72-4.2 8.22-14.36 8.22a41.54 41.54 0 0 1-15.47-3.12c-6.49-3.88-11.74-3.5-15.6 3.12l-5.59 9.31c-3.72 6.13-3.19 11.72 2.63 15.94 7.71 4.69 20.38 9.44 37 9.44 34.16 0 48.5-22.75 48.5-44.12-.03-14.38-9.12-29.76-28.73-34.88zM496 224H176a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16h320a16 16 0 0 0 16-16v-32a16 16 0 0 0-16-16zm0-160H176a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16h320a16 16 0 0 0 16-16V80a16 16 0 0 0-16-16zm0 320H176a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16h320a16 16 0 0 0 16-16v-32a16 16 0 0 0-16-16zM16 160h64a8 8 0 0 0 8-8v-16a8 8 0 0 0-8-8H64V40a8 8 0 0 0-8-8H32a8 8 0 0 0-7.14 4.42l-8 16A8 8 0 0 0 24 64h8v64H16a8 8 0 0 0-8 8v16a8 8 0 0 0 8 8zm-3.91 160H80a8 8 0 0 0 8-8v-16a8 8 0 0 0-8-8H41.32c3.29-10.29 48.34-18.68 48.34-56.44 0-29.06-25-39.56-44.47-39.56-21.36 0-33.8 10-40.46 18.75-4.37 5.59-3 10.84 2.8 15.37l8.58 6.88c5.61 4.56 11 2.47 16.12-2.44a13.44 13.44 0 0 1 9.46-3.84c3.33 0 9.28 1.56 9.28 8.75C51 248.19 0 257.31 0 304.59v4C0 316 5.08 320 12.09 320z"/></svg></button>

      <button 
        class="
          wrap-code-button
          tw-select-none 
          tw-mx-2 
          tw-hidden 
          group-[.is-open]:tw-block 
          group-[.is-wrap]:tw-text-fgColor-link 
          print:!tw-hidden" 
        title="Toggle code wrap"><svg class="icon"
    xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><!-- Font Awesome Free 5.15.4 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) --><path d="M16 132h416c8.837 0 16-7.163 16-16V76c0-8.837-7.163-16-16-16H16C7.163 60 0 67.163 0 76v40c0 8.837 7.163 16 16 16zm0 160h416c8.837 0 16-7.163 16-16v-40c0-8.837-7.163-16-16-16H16c-8.837 0-16 7.163-16 16v40c0 8.837 7.163 16 16 16zm0 160h416c8.837 0 16-7.163 16-16v-40c0-8.837-7.163-16-16-16H16c-8.837 0-16 7.163-16 16v40c0 8.837 7.163 16 16 16z"/></svg></button>
      
      <button 
        class="
          copy-code-button
          tw-select-none
          tw-mx-2 
          tw-hidden
          group-[.is-open]:tw-block
          hover:tw-text-fgColor-link 
          print:!tw-hidden"
        title="Copy code">
          <span class="copy-icon tw-block"><svg class="icon"
    xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><!-- Font Awesome Free 5.15.4 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) --><path d="M433.941 65.941l-51.882-51.882A48 48 0 0 0 348.118 0H176c-26.51 0-48 21.49-48 48v48H48c-26.51 0-48 21.49-48 48v320c0 26.51 21.49 48 48 48h224c26.51 0 48-21.49 48-48v-48h80c26.51 0 48-21.49 48-48V99.882a48 48 0 0 0-14.059-33.941zM266 464H54a6 6 0 0 1-6-6V150a6 6 0 0 1 6-6h74v224c0 26.51 21.49 48 48 48h96v42a6 6 0 0 1-6 6zm128-96H182a6 6 0 0 1-6-6V54a6 6 0 0 1 6-6h106v88c0 13.255 10.745 24 24 24h88v202a6 6 0 0 1-6 6zm6-256h-64V48h9.632c1.591 0 3.117.632 4.243 1.757l48.368 48.368a6 6 0 0 1 1.757 4.243V112z"/></svg></span>
          <span class="check-icon tw-hidden"><svg class="icon"
    xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><!-- Font Awesome Free 5.15.4 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) --><path d="M173.898 439.404l-166.4-166.4c-9.997-9.997-9.997-26.206 0-36.204l36.203-36.204c9.997-9.998 26.207-9.998 36.204 0L192 312.69 432.095 72.596c9.997-9.997 26.207-9.997 36.204 0l36.203 36.204c9.997 9.997 9.997 26.206 0 36.204l-294.4 294.401c-9.998 9.997-26.207 9.997-36.204-.001z"/></svg></span>
      </button>
        
      <button 
        class="
          tw-select-none 
          tw-mx-2 
          tw-block 
          group-[.is-open]:tw-hidden 
          print:!tw-hidden" 
        disabled
        aria-hidden="true"><svg class="icon"
    xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><!-- Font Awesome Free 5.15.4 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) --><path d="M328 256c0 39.8-32.2 72-72 72s-72-32.2-72-72 32.2-72 72-72 72 32.2 72 72zm104-72c-39.8 0-72 32.2-72 72s32.2 72 72 72 72-32.2 72-72-32.2-72-72-72zm-352 0c-39.8 0-72 32.2-72 72s32.2 72 72 72 72-32.2 72-72-32.2-72-72-72z"/></svg></button>
    </div>
  </div>
  <pre style="counter-reset: codeblock;" class="tw-block tw-m-0 tw-p-0"><code 
    id="codeblock-id-2" 
    class="
      chroma 
      !tw-block 
      tw-p-0
      tw-m-0
      tw-transition-[max-height] 
      tw-duration-500 
      tw-ease-in-out 
      group-[.is-closed]:!tw-max-h-0 
      group-[.is-wrap]:tw-text-wrap
      tw-overflow-y-hidden
      tw-overflow-x-auto
      tw-scrollbar-thin
      "><span class="line"><span class="cl">origin  https://github.com/user/repo.git <span class="o">(</span>fetch<span class="o">)</span>
</span></span><span class="line"><span class="cl">origin  https://github.com/user/repo.git <span class="o">(</span>push<span class="o">)</span></span></span></code></pre>
</div>
</li>
</ul>
</li>
<li>
<p><strong>常见的 <code>origin</code> 用法</strong>：</p>
<ul>
<li><code>git fetch origin</code>：从 <code>origin</code> 获取远程更新。</li>
<li><code>git push origin &lt;branch-name&gt;</code>：将本地的某个分支推送到 <code>origin</code> 上。</li>
<li><code>git pull origin &lt;branch-name&gt;</code>：从 <code>origin</code> 拉取并合并远程分支到当前分支。</li>
</ul>
</li>
<li>
<p><strong>修改远程仓库名称</strong>：</p>
<ul>
<li>
<p>如果你想给远程仓库指定不同的名称（除了 <code>origin</code>），可以使用 <code>git remote rename</code> 命令：</p>
<div class="code-block highlight is-open show-line-numbers  tw-group tw-my-2">
  <div class="
    code-block-title 
    
    tw-flex 
    tw-flex-row 
    tw-justify-between 
    tw-w-full tw-bg-bgColor-secondary
    ">      
    <button 
      class="
        tw-select-none 
        tw-mx-2 
        tw-block
        group-[.is-open]:tw-rotate-90
        tw-transition-[transform] 
        tw-duration-500 
        tw-ease-in-out
        print:!tw-hidden"
      disabled
      aria-hidden="true"><svg class="icon"
    xmlns="http://www.w3.org/2000/svg" viewBox="0 0 320 512"><!-- Font Awesome Free 5.15.4 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) --><path d="M285.476 272.971L91.132 467.314c-9.373 9.373-24.569 9.373-33.941 0l-22.667-22.667c-9.357-9.357-9.375-24.522-.04-33.901L188.505 256 34.484 101.255c-9.335-9.379-9.317-24.544.04-33.901l22.667-22.667c9.373-9.373 24.569-9.373 33.941 0L285.475 239.03c9.373 9.372 9.373 24.568.001 33.941z"/></svg></button>

    <div class="code-block-title-bar tw-w-full">
      <p class="tw-select-none !tw-my-1">bash</p>
    </div>
    <div class="tw-flex">
      <button 
        class="
          line-number-button
          tw-select-none 
          tw-mx-2 
          tw-hidden 
          group-[.is-open]:tw-block 
          group-[.show-line-numbers]:tw-text-fgColor-link 
          print:!tw-hidden" 
        title="Toggle line numbers"><svg class="icon"
    xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><!-- Font Awesome Free 5.15.4 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) --><path d="M61.77 401l17.5-20.15a19.92 19.92 0 0 0 5.07-14.19v-3.31C84.34 356 80.5 352 73 352H16a8 8 0 0 0-8 8v16a8 8 0 0 0 8 8h22.83a157.41 157.41 0 0 0-11 12.31l-5.61 7c-4 5.07-5.25 10.13-2.8 14.88l1.05 1.93c3 5.76 6.29 7.88 12.25 7.88h4.73c10.33 0 15.94 2.44 15.94 9.09 0 4.72-4.2 8.22-14.36 8.22a41.54 41.54 0 0 1-15.47-3.12c-6.49-3.88-11.74-3.5-15.6 3.12l-5.59 9.31c-3.72 6.13-3.19 11.72 2.63 15.94 7.71 4.69 20.38 9.44 37 9.44 34.16 0 48.5-22.75 48.5-44.12-.03-14.38-9.12-29.76-28.73-34.88zM496 224H176a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16h320a16 16 0 0 0 16-16v-32a16 16 0 0 0-16-16zm0-160H176a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16h320a16 16 0 0 0 16-16V80a16 16 0 0 0-16-16zm0 320H176a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16h320a16 16 0 0 0 16-16v-32a16 16 0 0 0-16-16zM16 160h64a8 8 0 0 0 8-8v-16a8 8 0 0 0-8-8H64V40a8 8 0 0 0-8-8H32a8 8 0 0 0-7.14 4.42l-8 16A8 8 0 0 0 24 64h8v64H16a8 8 0 0 0-8 8v16a8 8 0 0 0 8 8zm-3.91 160H80a8 8 0 0 0 8-8v-16a8 8 0 0 0-8-8H41.32c3.29-10.29 48.34-18.68 48.34-56.44 0-29.06-25-39.56-44.47-39.56-21.36 0-33.8 10-40.46 18.75-4.37 5.59-3 10.84 2.8 15.37l8.58 6.88c5.61 4.56 11 2.47 16.12-2.44a13.44 13.44 0 0 1 9.46-3.84c3.33 0 9.28 1.56 9.28 8.75C51 248.19 0 257.31 0 304.59v4C0 316 5.08 320 12.09 320z"/></svg></button>

      <button 
        class="
          wrap-code-button
          tw-select-none 
          tw-mx-2 
          tw-hidden 
          group-[.is-open]:tw-block 
          group-[.is-wrap]:tw-text-fgColor-link 
          print:!tw-hidden" 
        title="Toggle code wrap"><svg class="icon"
    xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><!-- Font Awesome Free 5.15.4 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) --><path d="M16 132h416c8.837 0 16-7.163 16-16V76c0-8.837-7.163-16-16-16H16C7.163 60 0 67.163 0 76v40c0 8.837 7.163 16 16 16zm0 160h416c8.837 0 16-7.163 16-16v-40c0-8.837-7.163-16-16-16H16c-8.837 0-16 7.163-16 16v40c0 8.837 7.163 16 16 16zm0 160h416c8.837 0 16-7.163 16-16v-40c0-8.837-7.163-16-16-16H16c-8.837 0-16 7.163-16 16v40c0 8.837 7.163 16 16 16z"/></svg></button>
      
      <button 
        class="
          copy-code-button
          tw-select-none
          tw-mx-2 
          tw-hidden
          group-[.is-open]:tw-block
          hover:tw-text-fgColor-link 
          print:!tw-hidden"
        title="Copy code">
          <span class="copy-icon tw-block"><svg class="icon"
    xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><!-- Font Awesome Free 5.15.4 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) --><path d="M433.941 65.941l-51.882-51.882A48 48 0 0 0 348.118 0H176c-26.51 0-48 21.49-48 48v48H48c-26.51 0-48 21.49-48 48v320c0 26.51 21.49 48 48 48h224c26.51 0 48-21.49 48-48v-48h80c26.51 0 48-21.49 48-48V99.882a48 48 0 0 0-14.059-33.941zM266 464H54a6 6 0 0 1-6-6V150a6 6 0 0 1 6-6h74v224c0 26.51 21.49 48 48 48h96v42a6 6 0 0 1-6 6zm128-96H182a6 6 0 0 1-6-6V54a6 6 0 0 1 6-6h106v88c0 13.255 10.745 24 24 24h88v202a6 6 0 0 1-6 6zm6-256h-64V48h9.632c1.591 0 3.117.632 4.243 1.757l48.368 48.368a6 6 0 0 1 1.757 4.243V112z"/></svg></span>
          <span class="check-icon tw-hidden"><svg class="icon"
    xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><!-- Font Awesome Free 5.15.4 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) --><path d="M173.898 439.404l-166.4-166.4c-9.997-9.997-9.997-26.206 0-36.204l36.203-36.204c9.997-9.998 26.207-9.998 36.204 0L192 312.69 432.095 72.596c9.997-9.997 26.207-9.997 36.204 0l36.203 36.204c9.997 9.997 9.997 26.206 0 36.204l-294.4 294.401c-9.998 9.997-26.207 9.997-36.204-.001z"/></svg></span>
      </button>
        
      <button 
        class="
          tw-select-none 
          tw-mx-2 
          tw-block 
          group-[.is-open]:tw-hidden 
          print:!tw-hidden" 
        disabled
        aria-hidden="true"><svg class="icon"
    xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><!-- Font Awesome Free 5.15.4 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) --><path d="M328 256c0 39.8-32.2 72-72 72s-72-32.2-72-72 32.2-72 72-72 72 32.2 72 72zm104-72c-39.8 0-72 32.2-72 72s32.2 72 72 72 72-32.2 72-72-32.2-72-72-72zm-352 0c-39.8 0-72 32.2-72 72s32.2 72 72 72 72-32.2 72-72-32.2-72-72-72z"/></svg></button>
    </div>
  </div>
  <pre style="counter-reset: codeblock;" class="tw-block tw-m-0 tw-p-0"><code 
    id="codeblock-id-3" 
    class="
      chroma 
      !tw-block 
      tw-p-0
      tw-m-0
      tw-transition-[max-height] 
      tw-duration-500 
      tw-ease-in-out 
      group-[.is-closed]:!tw-max-h-0 
      group-[.is-wrap]:tw-text-wrap
      tw-overflow-y-hidden
      tw-overflow-x-auto
      tw-scrollbar-thin
      "><span class="line"><span class="cl">git remote rename origin new-remote-name</span></span></code></pre>
</div>
</li>
</ul>
</li>
<li>
<p><strong><code>origin</code> 只是一个名字</strong>：</p>
<ul>
<li><code>origin</code> 只是一个约定俗成的名称，你完全可以把它改为其他名字。如果你与多个远程仓库交互，可以给每个远程仓库取不同的名字，例如 <code>upstream</code> 或 <code>myfork</code>，这样有助于区分不同的远程仓库。</li>
</ul>
</li>
</ol>
<p>总之，<code>origin</code> 是 Git 中的一个默认远程仓库别名，用于简化与远程仓库的交互。</p>
<h3 id="操作动词" class="headerLink">
    <a href="#%e6%93%8d%e4%bd%9c%e5%8a%a8%e8%af%8d" class="header-mark"></a>操作（动词）</h3><ul>
<li><code>push</code>：推送，将本地的 commit 推送到远程仓库。</li>
<li><code>pull</code>：拉取，从远程仓库拉取最新的 commit。</li>
<li><code>merge</code>：合并，将两个分支的 commit 合并成一个 commit。</li>
<li><code>rebase</code>：变基，将一个分支的 commit 变基到另一个分支上。</li>
<li><code>reset</code>：重置，将暂存区和工作区重置到指定的 commit。</li>
<li><code>checkout</code>：检出，将工作区切换到指定的 commit。</li>
</ul>
<h2 id="git-基本命令" class="headerLink">
    <a href="#git-%e5%9f%ba%e6%9c%ac%e5%91%bd%e4%bb%a4" class="header-mark"></a>git 基本命令</h2><ul>
<li>
<p><code>git init</code>：初始化 git 仓库</p>
</li>
<li>
<p><code>git add &lt;file&gt;...</code>：添加文件到暂存区</p>
</li>
<li>
<p><code>git add .</code> 或 <code>git add -A</code>：添加所有文件到暂存区</p>
</li>
<li>
<p><code>git status</code>：查看当前 git 状态</p>
</li>
</ul>
<hr>
<ul>
<li><code>git diff</code>：查看暂存区与工作区的差异</li>
<li><code>git diff --cached</code>：查看暂存区与本地仓库的差异</li>
<li><code>git diff HEAD</code>：查看工作区与本地仓库的差异</li>
<li><code>git diff &lt;commit&gt;</code>：查看工作区与指定 commit 的差异</li>
<li><code>git diff &lt;commit&gt; &lt;commit&gt;</code>：查看两个 commit 之间的差异</li>
<li><code>git diff &lt;branch&gt;</code>：查看工作区与指定 branch 的差异</li>
<li><code>git diff &lt;branch&gt; &lt;branch&gt;</code>：查看两个 branch 之间的差异</li>
<li><code>git diff &lt;commit&gt; &lt;branch&gt;</code>：查看 commit 与 branch 之间的差异</li>
<li><code>git diff &lt;commit&gt; &lt;commit&gt; &lt;branch&gt;</code>：查看两个 commit 与 branch 之间的差异</li>
<li><code>git diff &lt;commit&gt; &lt;commit&gt; &lt;commit&gt;</code>：查看三个 commit 之间的差异</li>
</ul>
<hr>
<ul>
<li><code>git rm &lt;file&gt;</code>：删除文件</li>
<li><code>git mv &lt;file&gt; &lt;file&gt;</code>：移动文件</li>
<li><code>git rm --cached &lt;file&gt;</code>：删除暂存区的文件</li>
<li><code>git mv --cached &lt;file&gt; &lt;file&gt;</code>：移动暂存区的文件</li>
</ul>
<hr>
<ul>
<li><code>git reset</code>：重置暂存区</li>
<li><code>git reset --hard</code>：重置暂存区和工作区</li>
<li><code>git reset --soft</code>：重置暂存区，保留工作区</li>
<li><code>git reset --mixed</code>：重置暂存区和工作区，保留 commit</li>
<li><code>git reset --hard &lt;commit&gt;</code>：重置暂存区和工作区到指定 commit</li>
<li><code>git reset --soft &lt;commit&gt;</code>：重置暂存区到指定 commit，保留工作区</li>
<li><code>git reset --mixed &lt;commit&gt;</code>：重置暂存区和工作区到指定 commit，保留 commit</li>
<li><code>git reset --hard HEAD~1</code>：重置暂存区和工作区到上一个 commit</li>
<li><code>git reset --hard HEAD^^</code>：重置暂存区和工作区到上两个 commit</li>
<li><code>git reset --hard HEAD~n</code>：重置暂存区和工作区到上 n 个 commit</li>
<li>撤销提交后恢复（<code>git reset</code>、<code>git commit --amend</code>、<code>git revert</code>等方式撤销/修改了原来的提交）</li>
<li>
<ol>
<li><code>git log</code>：查看提交日志，找到需要恢复的 commit id</li>
</ol>
</li>
<li>
<ol start="2">
<li><code>git reset --hard &lt;commit_id&gt;</code>：重置暂存区和工作区到指定 commit</li>
</ol>
</li>
<li>
<ol start="3">
<li><code>git reflog</code>：查看引用日志，找到需要恢复的 commit id。Git 的 reflog 记录了仓库中 HEAD 和分支头的变动历史。即使提交被撤销，它们仍然被记录在 reflog 中，只要它们还在 Git 的数据库中。</li>
</ol>
</li>
<li>
<ol start="4">
<li><code>git reset --hard &lt;commit_id&gt;</code>：重置暂存区和工作区到指定 commit</li>
</ol>
</li>
</ul>
<hr>
<ul>
<li><code>git commit -m &quot;commit message&quot;</code>：提交暂存区的文件到本地仓库</li>
<li><code>git commit</code>：提交暂存区的文件到本地仓库</li>
<li><code>git commit --amend</code>：修改最近一次提交的 commit message</li>
</ul>
<hr>
<ul>
<li><code>git log</code>：查看提交日志，展示每次提交的 commit id、commit message、commit author、commit date</li>
<li><code>git log --oneline</code>：查看提交日志（简洁），展示每次提交的 commit id 和 commit message</li>
<li><code>git log --graph</code>：查看提交日志（图形化），展示提交树</li>
<li><code>git log --stat</code>：查看提交日志（统计），展示每次提交的修改文件和修改数</li>
<li><code>git log --pretty=format:&quot;%h - %an, %ar : %s&quot;</code>：查看提交日志（自定义格式），展示每次提交的 commit id、commit author、commit date 和 commit message</li>
<li><code>git log --pretty=format:&quot;%h - %an, %ar : %s&quot; --graph</code>：查看提交日志（自定义格式+图形化），展示每次提交的 commit id、commit author、commit date 和 commit message</li>
<li><code>git log &lt;branch&gt;</code>：查看指定分支的提交日志</li>
</ul>
<hr>
<ul>
<li><code>git tag</code>：查看所有标签</li>
<li><code>git show &lt;tagname&gt;</code>：查看标签信息</li>
<li><code>git tag &lt;tagname&gt;</code>：创建轻量标签</li>
<li><code>git tag &lt;tagname&gt; &lt;commit_hash&gt;</code>：为指定 commit 创建标签</li>
<li><code>git tag -a &lt;tagname&gt; -m &quot;tag message&quot;</code>：创建带有描述的标签</li>
<li><code>git tag -d &lt;tagname&gt;</code>：删除本地标签</li>
<li><code>git push origin &lt;tagname&gt;</code>：推送标签到远程仓库。标签默认旨在本地仓库存在。</li>
<li><code>git push origin --tags</code>：推送所有标签到远程仓库</li>
<li>删除远程标签步骤</li>
<li>
<ol>
<li>删除本地标签：<code>git tag -d &lt;tagname&gt;</code></li>
</ol>
</li>
<li>
<ol start="2">
<li>删除远程标签：<code>git push origin --delete tag &lt;tag_name&gt;</code></li>
</ol>
</li>
<li>
<ol start="3">
<li>验证是否删除：<code>git ls-remote --tags origin</code></li>
</ol>
</li>
</ul>
<hr>
<ul>
<li><code>git merge &lt;branch&gt;</code>：合并指定 branch 到当前 branch</li>
<li><code>git merge --no-ff &lt;branch&gt;</code>：合并指定 branch 到当前 branch，不使用 fast-forward</li>
<li><code>git merge --squash &lt;branch&gt;</code>：合并指定 branch 到当前 branch，将所有 commit 合并为一个 commit</li>
<li><code>git merge --no-commit &lt;branch&gt;</code>：合并指定 branch 到当前 branch，不自动提交</li>
<li><code>git merge --abort</code>：取消合并，回到合并前的状态</li>
<li><code>git merge --continue</code>：继续合并，解决冲突后继续合并，解决冲突后需要手动提交</li>
<li><code>git merge --ff-only &lt;branch&gt;</code>：合并指定 branch 到当前 branch，只使用 fast-forward</li>
<li><code>git merge --no-ff --no-commit &lt;branch&gt;</code>：合并指定 branch 到当前 branch，不使用 fast-forward，不自动提交</li>
<li><code>git merge --no-ff --squash &lt;branch&gt;</code>：合并指定 branch 到当前 branch，不使用 fast-forward，将所有 commit 合并为一个 commit</li>
<li><code>git merge --no-ff --no-commit --squash &lt;branch&gt;</code>：合并指定 branch 到当前 branch，不使用 fast-forward，不自动提交，将所有 commit 合并为一个 commit</li>
</ul>
<hr>
<ul>
<li><code>git rebase &lt;branch&gt;</code>：将当前 branch 的提交应用到指定 branch 上，保留指定 branch 的提交</li>
<li><code>git rebase --onto &lt;branch&gt; &lt;branch&gt;</code>：将当前 branch 的提交应用到指定 branch 上，忽略指定 branch 的提交</li>
<li><code>git rebase --interactive &lt;branch&gt;</code>：交互式 rebase，可以修改、删除、合并提交</li>
</ul>
<hr>
<ul>
<li><code>git branch</code>：查看当前分支</li>
<li><code>git branch &lt;branch&gt;</code>：创建分支</li>
<li><code>git branch -d &lt;branch&gt;</code>：删除分支</li>
<li><code>git branch -D &lt;branch&gt;</code>：强制删除分支</li>
<li><code>git branch -m &lt;branch&gt;</code>：重命名分支</li>
<li><code>git branch -M &lt;branch&gt;</code>：强制重命名分支</li>
<li><code>git branch -r</code>：查看远程分支</li>
<li><code>git branch -a</code>：查看所有分支</li>
<li><code>git branch -vv</code>：查看本地分支与远程分支的关联</li>
<li><code>git branch -u &lt;remote&gt;/&lt;branch&gt;</code>：设置本地分支与远程分支的关联</li>
<li><code>git branch -d -r &lt;remote&gt;/&lt;branch&gt;</code>：删除远程分支</li>
<li><code>git branch -D -r &lt;remote&gt;/&lt;branch&gt;</code>：强制删除远程分支
重命名远程分支</li>
<li><code>git branch -m &lt;old-branch&gt; &lt;new-branch&gt;</code>：重命名本地分支</li>
<li><code>git branch -M &lt;old-branch&gt; &lt;new-branch&gt;</code>：强制重命名本地分支</li>
</ul>
<hr>
<ul>
<li><code>git checkout &lt;branch&gt;</code>：切换分支</li>
<li><code>git checkout -b &lt;branch&gt;</code>：创建并切换分支</li>
<li><code>git checkout -B &lt;branch&gt;</code>：强制创建并切换分支</li>
<li><code>git checkout &lt;commit&gt;</code>：切换到指定 commit，即将 HEAD 指向这个commit。会提示 <code>detached HEAD</code> 警告，因为此时 HEAD 不再指向任何分支，而是指向一个具体的 commit。此时<strong>可以进行任意修改，但不会影响其他分支</strong>。如果需要创建一个新的分支来保存这些修改，可以使用 <code>git switch -c &lt;new-branch-name&gt;</code> 命令。</li>
<li><code>git checkout &lt;file&gt;</code>：恢复工作区文件到指定 commit</li>
<li><code>git checkout -- &lt;file&gt;</code>：恢复指定工作区文件到暂存区。用来放弃掉所有还没有加入到缓存区（就是 git add 命令）的修改，但是此命令不会删除掉刚新建的文件。因为刚新建的文件还没已有加入到 git 的管理系统中。所以对于git是未知的。手动删除即可。</li>
<li><code>git checkout -- .</code>：恢复工作区所有文件到暂存区。</li>
<li><code>git checkout -p &lt;branch&gt;</code>：比较当前分支与指定分支的差异</li>
<li><code>git checkout -p &lt;commit&gt;</code>：比较当前分支与指定 commit 的差异</li>
<li><code>git checkout -p &lt;file&gt;</code>：比较当前分支与指定文件的差异</li>
</ul>
<hr>
<ul>
<li><code>git switch &lt;branch&gt;</code>：切换分支</li>
<li><code>git switch -c &lt;branch&gt;</code>：创建并切换分支</li>
<li><code>git switch -C &lt;branch&gt;</code>：强制创建并切换分支</li>
<li><code>git switch --detach &lt;branch&gt;</code>：切换到指定分支，并将 HEAD 指向这个分支</li>
<li><code>git switch --create &lt;branch&gt;</code>：创建并切换分支</li>
</ul>
<h3 id="远程仓库操作" class="headerLink">
    <a href="#%e8%bf%9c%e7%a8%8b%e4%bb%93%e5%ba%93%e6%93%8d%e4%bd%9c" class="header-mark"></a>远程仓库操作</h3><ul>
<li><code>git clone &lt;repository&gt;</code>：克隆远程仓库</li>
<li><code>git clone &lt;repository&gt; &lt;directory&gt;</code>：克隆远程仓库到指定目录</li>
<li><code>git clone --depth &lt;depth&gt; &lt;repository&gt;</code>：克隆远程仓库，只克隆最近 depth 个 commit</li>
<li><code>git clone --branch &lt;branch&gt; &lt;repository&gt;</code>：克隆远程仓库的指定分支</li>
<li><code>git clone --single-branch &lt;repository&gt;</code>：克隆远程仓库的单个分支</li>
<li><code>git clone --mirror &lt;repository&gt;</code>：克隆远程仓库的镜像</li>
<li><code>git clone --bare &lt;repository&gt;</code>：克隆远程仓库的裸仓库</li>
<li><code>git clone --depth &lt;depth&gt; --branch &lt;branch&gt; &lt;repository&gt;</code>：克隆远程仓库的指定分支，只克隆最近 depth 个 commit</li>
<li><code>git clone --depth &lt;depth&gt; --single-branch &lt;repository&gt;</code>：克隆远程仓库的单个分支，只克隆最近 depth 个 commit</li>
<li><code>git clone --depth &lt;depth&gt; --mirror &lt;repository&gt;</code>：克隆远程仓库的镜像，只克隆最近 depth 个 commit</li>
<li><code>git clone --depth &lt;depth&gt; --bare &lt;repository&gt;</code>：克隆远程仓库的裸仓库，只克隆最近 depth 个 commit</li>
</ul>
<hr>
<ul>
<li>
<p><code>git remote -v</code>：查看远程仓库</p>
</li>
<li>
<p><code>git remote add &lt;name&gt; &lt;url&gt;</code>：添加远程仓库</p>
</li>
<li>
<p><code>git remote remove &lt;name&gt;</code>：删除远程仓库</p>
</li>
<li>
<p><code>git remote rename &lt;old-name&gt; &lt;new-name&gt;</code>：重命名远程仓库</p>
</li>
<li>
<p><code>git remote set-url &lt;name&gt; &lt;url&gt;</code>：设置远程仓库的 URL</p>
</li>
<li>
<p><code>git remote set-url --add &lt;name&gt; &lt;url&gt;</code>：添加远程仓库的 URL</p>
</li>
<li>
<p><code>git remote set-url --delete &lt;name&gt; &lt;url&gt;</code>：删除远程仓库的 URL</p>
</li>
<li>
<p><code>git remote update &lt;name&gt;</code>：更新远程仓库</p>
</li>
<li>
<p><code>git remote prune &lt;name&gt;</code>：删除远程仓库中已经不存在的分支</p>
</li>
<li>
<p><code>git remote show &lt;name&gt;</code>：查看远程仓库的信息</p>
</li>
<li>
<p><code>git remote set-head &lt;name&gt; &lt;branch&gt;</code>：设置远程仓库的默认分支</p>
</li>
<li>
<p><code>git remote set-branches &lt;name&gt; &lt;branch&gt;</code>：设置远程仓库的分支</p>
</li>
<li>
<p><code>git fetch &lt;name&gt;</code>：获取远程仓库的所有分支</p>
</li>
<li>
<p><code>git fetch &lt;name&gt; &lt;branch&gt;</code>：获取远程仓库的指定分支</p>
</li>
<li>
<p><code>git push &lt;name&gt; &lt;branch&gt;</code>：将当前分支推送到远程仓库的指定分支</p>
</li>
<li>
<p><code>git push &lt;name&gt; &lt;branch&gt;:&lt;branch&gt;</code>：将当前分支推送到远程仓库的指定分支，并重命名远程分支</p>
</li>
<li>
<p><code>git push -u &lt;name&gt; &lt;branch&gt;</code>：将当前分支推送到远程仓库的指定分支，并设置远程仓库的默认分支</p>
</li>
<li>
<p><code>git push origin --delete &lt;branch&gt;</code>：删除远程仓库的指定分支</p>
</li>
<li>
<p><code>git push --set-upstream origin &lt;branch&gt;</code>：设置远程仓库的默认分支</p>
</li>
<li>
<p><code>git pull &lt;name&gt; &lt;branch&gt;</code>：获取远程仓库的指定分支，并合并到当前分支</p>
</li>
<li>
<p><code>git pull --set-upstream origin &lt;branch&gt;</code>：获取远程仓库的指定分支，并设置远程仓库的默认分支</p>
</li>
</ul>]]></description></item><item><title>Matlab 2021a 安装与激活</title><link>https://wlcheng.cc/posts/install_matlab/</link><pubDate>Thu, 03 Apr 2025 18:39:48 +0800</pubDate><author><name>wlcheng</name></author><guid>https://wlcheng.cc/posts/install_matlab/</guid><description><![CDATA[<p>本文记录安装 Matlab 2021a 的安装过程，以及光天化日下的激活方法。</p>
<div class="details admonition information open">
    <div class="details-summary admonition-title">
        <span class="icon"><svg class="icon"
    xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><!-- Font Awesome Free 5.15.4 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) --><path d="M497.9 142.1l-46.1 46.1c-4.7 4.7-12.3 4.7-17 0l-111-111c-4.7-4.7-4.7-12.3 0-17l46.1-46.1c18.7-18.7 49.1-18.7 67.9 0l60.1 60.1c18.8 18.7 18.8 49.1 0 67.9zM284.2 99.8L21.6 362.4.4 483.9c-2.9 16.4 11.4 30.6 27.8 27.8l121.5-21.3 262.6-262.6c4.7-4.7 4.7-12.3 0-17l-111-111c-4.8-4.7-12.4-4.7-17.1 0zM124.1 339.9c-5.5-5.5-5.5-14.3 0-19.8l154-154c5.5-5.5 14.3-5.5 19.8 0s5.5 14.3 0 19.8l-154 154c-5.5 5.5-14.3 5.5-19.8 0zM88 424h48v36.3l-64.5 11.3-31.1-31.1L51.7 376H88v48z"/></svg></span>安装包下载<span class="details-icon"><svg class="icon"
    xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 512"><!-- Font Awesome Free 5.15.4 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) --><path d="M224.3 273l-136 136c-9.4 9.4-24.6 9.4-33.9 0l-22.6-22.6c-9.4-9.4-9.4-24.6 0-33.9l96.4-96.4-96.4-96.4c-9.4-9.4-9.4-24.6 0-33.9L54.3 103c9.4-9.4 24.6-9.4 33.9 0l136 136c9.5 9.4 9.5 24.6.1 34z"/></svg></span>
    </div>
    <div class="details-content">
        <div class="admonition-content"><ul>
<li>
<p>Matlab R2021a 安装包：</p>
<p><a href="https://ww2.mathworks.cn/products/new_products/release2021a.html" target="_blank" rel="noopener noreferrer">MathWorks 官方下载</a> 或转自 <a href="https://blog.csdn.net/GGY1102/article/details/121733746" target="_blank" rel="noopener noreferrer">Robot-G</a> 的 <a href="https://www.aliyundrive.com/s/BYPHMoAiLqq" target="_blank" rel="noopener noreferrer">阿里云盘</a></p>
</li>
<li>
<p>Matlab910Win 破解工具包：</p>
<p><a href="https://wlcheng.lanzouo.com/iAPxr0qkwoha" target="_blank" rel="noopener noreferrer">https://wlcheng.lanzouo.com/iAPxr0qkwoha</a> 密码:fcaz</p>
</li>
</ul>
</div></div></div>
<h2 id="r2021a安装流程" class="headerLink">
    <a href="#r2021a%e5%ae%89%e8%a3%85%e6%b5%81%e7%a8%8b" class="header-mark"></a>R2021a安装流程</h2><p>右键装载<code>Matlab910R2021a_Win64.iso</code>镜像文件：</p>
<div align="center" ><img src="https://img1.wlcheng.cc/images_for_blogs/20220404091149.png" alt="20220404091149" width="75%" style="box-shadow: 0 3px 6px rgba(0,0,0,0.16), 0 3px 6px rgba(0,0,0,0.23);border-radius:10px;"/></div>
<p>打开安装程序<code>setup.exe</code></p>
<div align="center" ><img src="https://img1.wlcheng.cc/images_for_blogs/20220404091400.png" alt="20220404091400" width="75%" style="box-shadow: 0 3px 6px rgba(0,0,0,0.16), 0 3px 6px rgba(0,0,0,0.23);border-radius:10px;"/></div>
<div align="center" ><img src="https://img1.wlcheng.cc/images_for_blogs/20220404091716.png" alt="20220404091716" width="75%" style="box-shadow: 0 3px 6px rgba(0,0,0,0.16), 0 3px 6px rgba(0,0,0,0.23);border-radius:10px;"/></div>
<p>在<code>高级选项</code>中选择<code>我有文件安装密钥</code></p>
<div align="center" ><img src="https://img1.wlcheng.cc/images_for_blogs/1649035568(1).jpg" alt="1649035568(1)" width="75%" style="box-shadow: 0 3px 6px rgba(0,0,0,0.16), 0 3px 6px rgba(0,0,0,0.23);border-radius:10px;"/></div>
<p>点选<code>是</code>接收许可协议条款，点击<code>下一步</code></p>
<div align="center" ><img src="https://img1.wlcheng.cc/images_for_blogs/20220404092934.png" alt="20220404092934" width="75%" style="box-shadow: 0 3px 6px rgba(0,0,0,0.16), 0 3px 6px rgba(0,0,0,0.23);border-radius:10px;"/></div>
<p>输入安装密钥<code>09806-07443-53955-64350-21751-41297</code>，点击<code>下一步</code>。</p>
<div class="details admonition information open">
    <div class="details-summary admonition-title">
        <span class="icon"><svg class="icon"
    xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><!-- Font Awesome Free 5.15.4 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) --><path d="M497.9 142.1l-46.1 46.1c-4.7 4.7-12.3 4.7-17 0l-111-111c-4.7-4.7-4.7-12.3 0-17l46.1-46.1c18.7-18.7 49.1-18.7 67.9 0l60.1 60.1c18.8 18.7 18.8 49.1 0 67.9zM284.2 99.8L21.6 362.4.4 483.9c-2.9 16.4 11.4 30.6 27.8 27.8l121.5-21.3 262.6-262.6c4.7-4.7 4.7-12.3 0-17l-111-111c-4.8-4.7-12.4-4.7-17.1 0zM124.1 339.9c-5.5-5.5-5.5-14.3 0-19.8l154-154c5.5-5.5 14.3-5.5 19.8 0s5.5 14.3 0 19.8l-154 154c-5.5 5.5-14.3 5.5-19.8 0zM88 424h48v36.3l-64.5 11.3-31.1-31.1L51.7 376H88v48z"/></svg></span>密钥<span class="details-icon"><svg class="icon"
    xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 512"><!-- Font Awesome Free 5.15.4 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) --><path d="M224.3 273l-136 136c-9.4 9.4-24.6 9.4-33.9 0l-22.6-22.6c-9.4-9.4-9.4-24.6 0-33.9l96.4-96.4-96.4-96.4c-9.4-9.4-9.4-24.6 0-33.9L54.3 103c9.4-9.4 24.6-9.4 33.9 0l136 136c9.5 9.4 9.5 24.6.1 34z"/></svg></span>
    </div>
    <div class="details-content">
        <div class="admonition-content"><p>如果是<code>standalone</code>方式，个人使用，填写密钥：09806-07443-53955-64350-21751-41297</p>
<p>如果是<code>Server</code>方式，作为服务器或集群节点，填写密钥：40236-45817-26714-51426-39281</p>
</div></div></div>
<div align="center" ><img src="https://img1.wlcheng.cc/images_for_blogs/20220404093455.png" alt="20220404093455" width="75%" style="box-shadow: 0 3px 6px rgba(0,0,0,0.16), 0 3px 6px rgba(0,0,0,0.23);border-radius:10px;"/></div>
<p>选择许可证文件：</p>
<div align="center" ><img src="https://img1.wlcheng.cc/images_for_blogs/20220404094343.png" alt="20220404094343" width="75%" style="box-shadow: 0 3px 6px rgba(0,0,0,0.16), 0 3px 6px rgba(0,0,0,0.23);border-radius:10px;"/></div>
<p>选择要安装的工具包。</p>
<div align="center" ><img src="https://img1.wlcheng.cc/images_for_blogs/20220404095532.png" alt="20220404095532" width="75%" style="box-shadow: 0 3px 6px rgba(0,0,0,0.16), 0 3px 6px rgba(0,0,0,0.23);border-radius:10px;"/></div>
<div align="center" ><img src="https://img1.wlcheng.cc/images_for_blogs/20220404095609.png" alt="20220404095609" width="75%" style="box-shadow: 0 3px 6px rgba(0,0,0,0.16), 0 3px 6px rgba(0,0,0,0.23);border-radius:10px;"/></div>
<p>安装完毕，<code>关闭</code>即可。</p>
<div align="center" ><img src="https://img1.wlcheng.cc/images_for_blogs/20220404102007.png" alt="20220404102007" width="75%" style="box-shadow: 0 3px 6px rgba(0,0,0,0.16), 0 3px 6px rgba(0,0,0,0.23);border-radius:10px;"/></div>
<h2 id="r2021a激活流程" class="headerLink">
    <a href="#r2021a%e6%bf%80%e6%b4%bb%e6%b5%81%e7%a8%8b" class="header-mark"></a>R2021a激活流程</h2><ul>
<li>拷贝文件夹<code>Matlab910Win</code>中的<code>libmwlmgrimpl.dll</code>文件到R2021a安装位置下的路径<code>&lt;matlab安装位置&gt;\bin\win64\matlab_startup_plugins\lmgrimpl</code>中：</li>
</ul>
<div align="center" ><img src="https://img1.wlcheng.cc/images_for_blogs/20220404103117.png" alt="20220404103117" width="75%" style="box-shadow: 0 3px 6px rgba(0,0,0,0.16), 0 3px 6px rgba(0,0,0,0.23);border-radius:10px;"/></div>
<ul>
<li>拷贝文件夹<code>Matlab910Win</code>中的<code>license.lic</code>文件到R2021a安装位置下的路径 <code>&lt;matlab安装位置&gt;\licenses</code>中：</li>
</ul>
<div align="center" ><img src="https://img1.wlcheng.cc/images_for_blogs/20220404103255.png" alt="20220404103255" width="75%" style="box-shadow: 0 3px 6px rgba(0,0,0,0.16), 0 3px 6px rgba(0,0,0,0.23);border-radius:10px;"/></div>
<p><strong>问题：</strong> 安装完后，发现开始菜单的图标不能正确显示。</p>
<div align="center" ><img src="https://img1.wlcheng.cc/images_for_blogs/20220404104307.png" alt="20220404104307" width="75%" style="box-shadow: 0 3px 6px rgba(0,0,0,0.16), 0 3px 6px rgba(0,0,0,0.23);border-radius:10px;"/></div>
<p><strong>解决：</strong> 按照以下操作自行创建开始菜单图标即可。</p>
<div align="center" ><img src="https://img1.wlcheng.cc/images_for_blogs/20220404103857.png" alt="20220404103857" width="75%" style="box-shadow: 0 3px 6px rgba(0,0,0,0.16), 0 3px 6px rgba(0,0,0,0.23);border-radius:10px;"/></div>
<ul>
<li><strong>参考：</strong></li>
</ul>
<p><strong>Robot-G</strong>, MATLAB (R2021a) 软件下载和安装教程, <a href="https://blog.csdn.net/GGY1102/article/details/121733746" target="_blank" rel="noopener noreferrer">https://blog.csdn.net/GGY1102/article/details/121733746</a></p>
<h2 id="r2018安装流程" class="headerLink">
    <a href="#r2018%e5%ae%89%e8%a3%85%e6%b5%81%e7%a8%8b" class="header-mark"></a>R2018安装流程</h2><p>勾选<code>使用文件安装密钥</code>，进入下一步：</p>
<div align="center" ><img src="https://img1.wlcheng.cc/images_for_blogs/20220403184426.png" alt="20220403184426" width="75%" style="box-shadow: 0 3px 6px rgba(0,0,0,0.16), 0 3px 6px rgba(0,0,0,0.23);border-radius:10px;"/></div>
<p>勾选<code>是</code>，进入下一步：</p>
<div align="center" ><img src="https://img1.wlcheng.cc/images_for_blogs/20220403184511.png" alt="20220403184511" width="75%" style="box-shadow: 0 3px 6px rgba(0,0,0,0.16), 0 3px 6px rgba(0,0,0,0.23);border-radius:10px;"/></div>
<p>输入密钥：09806-07443-53955-64350-21751-41297，进入下一步：</p>
<div align="center" ><img src="https://img1.wlcheng.cc/images_for_blogs/20220403184651.png" alt="20220403184651" width="75%" style="box-shadow: 0 3px 6px rgba(0,0,0,0.16), 0 3px 6px rgba(0,0,0,0.23);border-radius:10px;"/></div>
<p>选择安装目录，进入下一步：</p>
<div align="center" ><img src="https://img1.wlcheng.cc/images_for_blogs/20220403184856.png" alt="20220403184856" width="75%" style="box-shadow: 0 3px 6px rgba(0,0,0,0.16), 0 3px 6px rgba(0,0,0,0.23);border-radius:10px;"/></div>
<p>按需选择要安装的工具箱：</p>
<div align="center" ><img src="https://img1.wlcheng.cc/images_for_blogs/20220403193020.png" alt="20220403193020" width="75%" style="box-shadow: 0 3px 6px rgba(0,0,0,0.16), 0 3px 6px rgba(0,0,0,0.23);border-radius:10px;"/></div>
<div align="center" ><img src="https://img1.wlcheng.cc/images_for_blogs/20220403193144.png" alt="20220403193144" width="75%" style="box-shadow: 0 3px 6px rgba(0,0,0,0.16), 0 3px 6px rgba(0,0,0,0.23);border-radius:10px;"/></div>
<div align="center" ><img src="https://img1.wlcheng.cc/images_for_blogs/20220403193432.png" alt="20220403193432" width="75%" style="box-shadow: 0 3px 6px rgba(0,0,0,0.16), 0 3px 6px rgba(0,0,0,0.23);border-radius:10px;"/></div>
<p>确认要安装的清单后，点击安装：</p>
<div align="center" ><img src="https://img1.wlcheng.cc/images_for_blogs/20220403193344.png" alt="20220403193344" width="75%" style="box-shadow: 0 3px 6px rgba(0,0,0,0.16), 0 3px 6px rgba(0,0,0,0.23);border-radius:10px;"/></div>
<p>程序安装进程：</p>
<div align="center" ><img src="https://img1.wlcheng.cc/images_for_blogs/20220403193329.png" alt="20220403193329" width="75%" style="box-shadow: 0 3px 6px rgba(0,0,0,0.16), 0 3px 6px rgba(0,0,0,0.23);border-radius:10px;"/></div>
<p>打开看看效果</p>
<div align="center" ><img src="https://img1.wlcheng.cc/images_for_blogs/20220404105927.png" alt="20220404105927" width="75%" style="box-shadow: 0 3px 6px rgba(0,0,0,0.16), 0 3px 6px rgba(0,0,0,0.23);border-radius:10px;"/></div>
<h2 id="r2018-激活流程todo" class="headerLink">
    <a href="#r2018-%e6%bf%80%e6%b4%bb%e6%b5%81%e7%a8%8btodo" class="header-mark"></a>R2018 激活流程（TODO）</h2>]]></description></item><item><title>Github Token</title><link>https://wlcheng.cc/posts/github_token/</link><pubDate>Wed, 30 Oct 2024 16:32:12 +0800</pubDate><author><name>wlcheng</name></author><guid>https://wlcheng.cc/posts/github_token/</guid><description><![CDATA[<p>Generate github token</p>
<h2 id="创建token" class="headerLink">
    <a href="#%e5%88%9b%e5%bb%batoken" class="header-mark"></a>创建Token</h2><p><strong>Warning</strong>：Token一旦生成，无法再次查看，只能重新生成，所以一定要保存好。</p>
<ul>
<li>登录Github，点击右上角头像，选择Settings</li>
<li>左侧选择Developer settings</li>
<li>选择Personal access tokens，两种方式：
<ul>
<li>Tokens (classic)：经典版，简单但不能选择特定仓库和权限
<ul>
<li>点击右上角Generate new token</li>
<li>设置Token名称，选择Token有效期，勾选repo</li>
<li>点击Generate token，生成 token。</li>
<li>token 格式：<code>github_pat_&lt;22位随机字符&gt;_&lt;59位随机字符&gt;</code></li>
</ul>
</li>
<li>Fine-grained tokens：细粒度版，可以针对特定仓库和精细控制权限
<ul>
<li>点击右上角Generate new token</li>
<li>设置Token名称，选择Token有效期，选择特定仓库或所有仓库</li>
<li>添加权限类别 <code>Contents</code>，并选择 <code>read and write</code> 权限</li>
<li>点击Generate token，生成 token。</li>
<li>token 格式：<code>ghp_&lt;36位随机字母数字串&gt;</code></li>
</ul>
</li>
</ul>
</li>
</ul>]]></description></item><item><title>Windows 自用软件清单</title><link>https://wlcheng.cc/posts/windows_envs_backup/</link><pubDate>Tue, 18 Jun 2024 08:56:38 +0800</pubDate><author><name>wlcheng</name></author><guid>https://wlcheng.cc/posts/windows_envs_backup/</guid><description><![CDATA[<p>为了在新系统上能快速恢复工作环境，备份一下相关配置。</p>
<h3 id="软件清单" class="headerLink">
    <a href="#%e8%bd%af%e4%bb%b6%e6%b8%85%e5%8d%95" class="header-mark"></a>软件清单</h3><h4 id="必备软件" class="headerLink">
    <a href="#%e5%bf%85%e5%a4%87%e8%bd%af%e4%bb%b6" class="header-mark"></a>必备软件</h4><ul>
<li><a href="https://weixin.qq.com/" target="_blank" rel="noopener noreferrer">微信</a>，即时通讯</li>
<li><a href="https://tim.qq.com/" target="_blank" rel="noopener noreferrer">TIM</a>，即时通讯</li>
<li><a href="https://meeting.tencent.com/" target="_blank" rel="noopener noreferrer">腾讯会议</a>，会议</li>
<li><a href="https://mail.163.com/" target="_blank" rel="noopener noreferrer">网易邮箱大师</a>，邮件客户端</li>
<li><a href="https://www.microsoft.com/zh-cn/microsoft-365/outlook/email-and-calendar-software-microsoft-outlook/?msockid=392e478147196cdc3e6f5406466e6dee#Download-the-app" target="_blank" rel="noopener noreferrer">Outlook</a>，Windows 自带邮件客户端</li>
<li><a href="https://github.com/clashdownload/Clash_for_Windows" target="_blank" rel="noopener noreferrer">Clash for Windows</a>，科学上网。备用订阅：
<ul>
<li><a href="https://raw.kkgithub.com/ripaojiedian/freenode/main/clash" target="_blank" rel="noopener noreferrer">https://raw.kkgithub.com/ripaojiedian/freenode/main/clash</a></li>
<li><a href="https://ghostcc.cc/ss.cn/cn.ovg" target="_blank" rel="noopener noreferrer">https://ghostcc.cc/ss.cn/cn.ovg</a></li>
<li><a href="https://sub.sharecentre.online/sub" target="_blank" rel="noopener noreferrer">https://sub.sharecentre.online/sub</a></li>
</ul>
</li>
<li><a href="https://github.com/2dust/v2rayN" target="_blank" rel="noopener noreferrer">V2RayN</a>，科学上网</li>
</ul>
<hr>
<ul>
<li><a href="https://follow.is/" target="_blank" rel="noopener noreferrer">Folo</a>，类 RSS 信息聚合，开源，AI 总结</li>
</ul>
<hr>
<ul>
<li><a href="https://www.trae.ai/" target="_blank" rel="noopener noreferrer">Trae</a>，AI 编程 IDE</li>
</ul>
<hr>
<ul>
<li><a href="___" rel="">MicroSoft Office 套件</a>：用 <a href="https://otp.landian.vip/zh-cn/" target="_blank" rel="noopener noreferrer">OTP</a> 安装，用 <a href="https://github.com/zbezj/HEU_KMS_Activator/releases" target="_blank" rel="noopener noreferrer">HEU_KMS_Activator</a> 激活</li>
<li><a href="http://www.ffcell.com/" target="_blank" rel="noopener noreferrer">方方格子</a>，Excel 插件</li>
<li><a href="https://www.texstudio.org/" target="_blank" rel="noopener noreferrer">TexStudio</a>，LaTeX 集成编辑器</li>
<li><a href="https://www.tug.org/texlive/" target="_blank" rel="noopener noreferrer">Texlive</a>，LaTeX 编译器</li>
</ul>
<hr>
<ul>
<li><a href="___" rel="">Visio</a>：MicroSoft 流程图工具，可用 <a href="https://otp.landian.vip/zh-cn/" target="_blank" rel="noopener noreferrer">OTP</a> 安装</li>
<li><a href="https://app.diagrams.net/" target="_blank" rel="noopener noreferrer">Draw.io</a>，绘图工具</li>
<li><a href="https://www.originlab.com/" target="_blank" rel="noopener noreferrer">Origin</a>，数据分析和绘图工具</li>
</ul>
<hr>
<ul>
<li><a href="https://www.sumatrapdfreader.org/free-pdf-reader.html" target="_blank" rel="noopener noreferrer">SumatraPDF</a>，PDF 阅读器</li>
<li><a href="https://www.adobe.com/cn/products/acrobat.html" target="_blank" rel="noopener noreferrer">Adobe Acrobat DC</a>，PDF 编辑/阅读器</li>
<li><a href="https://tools.pdf24.org/zh/" target="_blank" rel="noopener noreferrer">PDF24 Creator</a>，PDF 工具箱，特好用</li>
<li><a href="https://www.cnblogs.com/pdfpatcher" target="_blank" rel="noopener noreferrer">PDF 补丁丁</a>，有情怀的强大 PDF 编辑工具。半自动制目录、解除限制、替换字体等等。作者的情怀：</li>
</ul>
<div align="center" ><img src="https://img1.xiangyichen.cn/images/20250402212237.png" alt="20250402212237" width="75%" style="box-shadow: 0 3px 6px rgba(0,0,0,0.16), 0 3px 6px rgba(0,0,0,0.23);border-radius:10px;"/><br><div style="color:orange; border-bottom: 1px solid #d9d9d9; display: inline-block; color: #777; font-size: 90%; padding: 1px;"></div></div>
<hr>
<ul>
<li><a href="https://www.aliyundrive.com/" target="_blank" rel="noopener noreferrer">阿里云盘</a>，云盘</li>
<li><a href="https://www.jianguoyun.com/" target="_blank" rel="noopener noreferrer">坚果云</a>，文件同步，版本管理</li>
<li><a href="https://github.com/canton7/SyncTrayzor" target="_blank" rel="noopener noreferrer">SyncTrayzor</a>，基于 Syncthing 的开源文件同步工具</li>
<li><a href="https://www.todesk.com/" target="_blank" rel="noopener noreferrer">ToDesk</a>，远程桌面控制</li>
<li><a href="https://rustdesk.com/" target="_blank" rel="noopener noreferrer">RustDesk</a>，开源远程桌面控制</li>
</ul>
<hr>
<ul>
<li><a href="https://copytranslator.github.io/" target="_blank" rel="noopener noreferrer">CopyTranslator</a>，即时文字多源翻译工具</li>
</ul>
<hr>
<ul>
<li><a href="https://www.bandisoft.com/bandizip/" target="_blank" rel="noopener noreferrer">Bandizip</a>，压缩解压工具</li>
<li><a href="https://www.voidtools.com/zh-cn/downloads/" target="_blank" rel="noopener noreferrer">Everything</a>，快速文件搜索</li>
<li><a href="https://apps.microsoft.com/detail/9P1WXPKB68KX?hl=zh-cn&amp;gl=CN&amp;ocid=pdpshare" target="_blank" rel="noopener noreferrer">Snipaste</a>，截图贴图</li>
<li><a href="https://apps.microsoft.com/detail/9NV4BS3L1H4S?hl=zh&amp;gl=CN&amp;ocid=pdpshare" target="_blank" rel="noopener noreferrer">Quicklook</a>，快速预览文件</li>
<li><a href="https://www.internetdownloadmanager.com/download.html" target="_blank" rel="noopener noreferrer">IDM</a>，多线程下载器</li>
<li><a href="https://geekuninstaller.com/" target="_blank" rel="noopener noreferrer">Geek Uninstaller</a>，免费卸载软件，简单够用</li>
<li><a href="https://www.bcuninstaller.com/" target="_blank" rel="noopener noreferrer">BC Uninstaller</a>，开源卸载软件，复杂而强大，支持批量，可查绿色安装软件</li>
</ul>
<hr>
<ul>
<li><a href="https://code.visualstudio.com/" target="_blank" rel="noopener noreferrer">VSCode</a>，代码编辑器，扩展性极强</li>
<li><a href="https://git-scm.com/" target="_blank" rel="noopener noreferrer">Git</a>，版本控制</li>
<li><a href="https://typora.io/" target="_blank" rel="noopener noreferrer">Typora</a>，优雅的 Markdown 编辑器（v1.0 后付费）</li>
<li><a href="https://marktext.app/" target="_blank" rel="noopener noreferrer">MarkText</a>，（仿Typora）开源 Markdown 编辑器</li>
<li><a href="https://flowus.cn/" target="_blank" rel="noopener noreferrer">Flowus 息流</a>，大纲笔记，可上传文件</li>
<li><a href="https://soft.xiaoshujiang.com/" target="_blank" rel="noopener noreferrer">小书匠</a>，Markdown 编辑器，非常炫酷</li>
</ul>
<hr>
<ul>
<li><a href="https://github.com/lyswhut/lx-music-desktop" target="_blank" rel="noopener noreferrer">洛雪音乐助手</a>，多平台聚合音乐播放器
<ul>
<li><a href="https://awaw.cc/post/lx-music-source/" target="_blank" rel="noopener noreferrer">音源</a>（音源）</li>
</ul>
</li>
<li><a href="https://potplayer.daum.net/" target="_blank" rel="noopener noreferrer">PotPlayer</a>, 视频播放器</li>
<li><a href="https://snake.timeline.ink/latest" target="_blank" rel="noopener noreferrer">拾光壁纸</a>，干净简介多源壁纸工具</li>
<li><a href="https://github.com/Alxndr/whc" target="_blank" rel="noopener noreferrer">WallHaven</a>，壁纸工具，来自网站 <a href="https://wallhaven.cc/" target="_blank" rel="noopener noreferrer">WallHaven</a></li>
<li><a href="https://apps.microsoft.com/detail/9NBLGGH516XP?hl=zh-cn&amp;gl=CN&amp;ocid=pdpshare" target="_blank" rel="noopener noreferrer">EarTrumpet</a>，软件独立音量控制</li>
<li><a href="https://apps.microsoft.com/detail/9PLJWWSV01LK?hl=neutral&amp;gl=CN&amp;ocid=pdpshare" target="_blank" rel="noopener noreferrer">Twinkle Tray</a>，显示器亮度调节</li>
</ul>
<hr>
<h4 id="其他" class="headerLink">
    <a href="#%e5%85%b6%e4%bb%96" class="header-mark"></a>其他</h4><ul>
<li><a href="https://getquicker.net/" target="_blank" rel="noopener noreferrer">Quicker</a>，指尖工具箱，快捷操作工具</li>
<li><a href="https://www.listary.com/" target="_blank" rel="noopener noreferrer">Listary</a>，快捷文件搜索、路径定位</li>
<li><a href="https://www.q-dir.com/" target="_blank" rel="noopener noreferrer">Q-Dir</a>，多窗口文件管理器</li>
<li><a href="https://www.7-zip.org/" target="_blank" rel="noopener noreferrer">7-Zip</a>，压缩解压工具</li>
<li><a href="https://www.mythicsoft.com/" target="_blank" rel="noopener noreferrer">FileLocator</a>，快速文件内容搜索</li>
<li><a href="https://www.textseek.net/" target="_blank" rel="noopener noreferrer">TextSeek</a>，快速文件内容搜索</li>
<li><a href="https://www.scootersoftware.com/" target="_blank" rel="noopener noreferrer">Beyond Compare</a>，文件对比工具，收费</li>
<li><a href="https://winmerge.org/" target="_blank" rel="noopener noreferrer">WinMerge</a>，文件夹/文件对比工具，开源免费</li>
<li><a href="https://meldmerge.org/" target="_blank" rel="noopener noreferrer">Meld</a>，文件夹/文件对比工具，开源，Win/Mac/Linux</li>
<li><a href="___" rel="">BestTrace</a>，网络诊断工具</li>
<li><a href="https://switchhosts.vercel.app/zh" target="_blank" rel="noopener noreferrer">SwitchHosts</a>，hosts 编辑工具</li>
<li><a href="https://www.wireshark.org/" target="_blank" rel="noopener noreferrer">WireShark</a>，网络抓包工具</li>
<li><a href="https://mobaxterm.mobatek.net/" target="_blank" rel="noopener noreferrer">MobaXterm</a>，SSH 客户端</li>
<li><a href="https://www.spacedesk.net/" target="_blank" rel="noopener noreferrer">SpaceDesk</a>，桌面扩展、手写板、终端摄像头</li>
<li><a href="https://www.petges.lu/" target="_blank" rel="noopener noreferrer">Attribute Changer</a>，文件属性修改工具</li>
<li><a href="https://www.antp.be/software/renamer" target="_blank" rel="noopener noreferrer">Ant Renamer</a>，文件批量重命名工具</li>
<li><a href="https://lockhunter.com/" target="_blank" rel="noopener noreferrer">LockHunter</a>，文件锁定解除工具</li>
<li>&hellip;&hellip;</li>
</ul>
<h4 id="字体" class="headerLink">
    <a href="#%e5%ad%97%e4%bd%93" class="header-mark"></a>字体</h4><ul>
<li><a href="https://github.com/lxgw/LxgwWenKai" target="_blank" rel="noopener noreferrer">霞鹜文楷</a>，开源字体</li>
<li><a href="https://github.com/lxgw/LxgwZhenKai" target="_blank" rel="noopener noreferrer">霞鹜臻楷</a>，开源字体，霞鹜文楷的加粗衍生，但不和霞鹜文楷同步更新</li>
<li><a href="https://wordshub.github.io/free-font/font.html?JiangXiZhuoKai_Regular" target="_blank" rel="noopener noreferrer">江西拙楷</a>，免费字体</li>
<li><a href="https://github.com/laomao314/SourceHanSansSC-Nerd" target="_blank" rel="noopener noreferrer">更纱黑体</a>，开源字体</li>
<li>&hellip;&hellip;</li>
</ul>
<h3 id="配置清单" class="headerLink">
    <a href="#%e9%85%8d%e7%bd%ae%e6%b8%85%e5%8d%95" class="header-mark"></a>配置清单</h3><h4 id="vscode-插件备份" class="headerLink">
    <a href="#vscode-%e6%8f%92%e4%bb%b6%e5%a4%87%e4%bb%bd" class="header-mark"></a>VSCode 插件备份</h4><ul>
<li>
<p><a href="https://marketplace.visualstudio.com/items?itemName=christian-kohler.path-intellisense" target="_blank" rel="noopener noreferrer">Path Intelligence</a></p>
</li>
<li>
<p>Latex</p>
<ul>
<li><a href="https://marketplace.visualstudio.com/items?itemName=James-Yu.latex-workshop" target="_blank" rel="noopener noreferrer">Latex Workshop</a></li>
</ul>
</li>
<li>
<p>Markdown</p>
<ul>
<li><a href="https://marketplace.visualstudio.com/items?itemName=yzhang.markdown-all-in-one" target="_blank" rel="noopener noreferrer">Markdown All in One</a></li>
<li><a href="https://marketplace.visualstudio.com/items?itemName=shd101wyy.markdown-preview-enhanced" target="_blank" rel="noopener noreferrer">Markdown Preview Enhanced</a></li>
<li><a href="https://marketplace.visualstudio.com/items?itemName=yzane.vscode-markdown-pdf" target="_blank" rel="noopener noreferrer">Markdown PDF</a></li>
<li><a href="https://marketplace.visualstudio.com/items?itemName=DavidAnson.vscode-markdownlint" target="_blank" rel="noopener noreferrer">markdownlint</a></li>
<li><a href="https://marketplace.visualstudio.com/items?itemName=Spades.vs-picgo" target="_blank" rel="noopener noreferrer">PicGo</a></li>
</ul>
</li>
<li>
<p>Matlab</p>
<ul>
<li><a href="https://marketplace.visualstudio.com/items?itemName=krasserm.matlab-formatter" target="_blank" rel="noopener noreferrer">matlab-formatter</a></li>
</ul>
</li>
<li>
<p>Python</p>
<ul>
<li><a href="https://marketplace.visualstudio.com/items?itemName=ms-python.python" target="_blank" rel="noopener noreferrer">Python</a></li>
<li><a href="https://marketplace.visualstudio.com/items?itemName=ms-python.pylance" target="_blank" rel="noopener noreferrer">Pylance</a></li>
<li><a href="https://marketplace.visualstudio.com/items?itemName=ms-python.debugpy" target="_blank" rel="noopener noreferrer">Python Debugger</a></li>
<li><a href="https://marketplace.visualstudio.com/items?itemName=ms-toolsai.jupyter" target="_blank" rel="noopener noreferrer">Jupyter</a></li>
<li><a href="https://marketplace.visualstudio.com/items?itemName=ms-toolsai.jupyter-renderers" target="_blank" rel="noopener noreferrer">Jupyter Notebook Renderers</a></li>
</ul>
</li>
<li>
<p>美化</p>
<ul>
<li><a href="https://marketplace.visualstudio.com/items?itemName=zhuangtongfa.Material-theme" target="_blank" rel="noopener noreferrer">One Dark Pro</a></li>
<li><a href="https://marketplace.visualstudio.com/items?itemName=johnpapa.winteriscoming" target="_blank" rel="noopener noreferrer">Winter id Coming Theme</a></li>
<li><a href="https://marketplace.visualstudio.com/items?itemName=vscode-icons-team.vscode-icons" target="_blank" rel="noopener noreferrer">vscode-icons</a></li>
<li><a href="https://marketplace.visualstudio.com/items?itemName=wwm.better-align" target="_blank" rel="noopener noreferrer">Better Align</a></li>
<li><a href="https://marketplace.visualstudio.com/items?itemName=aaron-bond.better-comments" target="_blank" rel="noopener noreferrer">Better Comments</a></li>
<li><a href="https://marketplace.visualstudio.com/items?itemName=naumovs.color-highlight" target="_blank" rel="noopener noreferrer">Color Highlight</a></li>
<li><a href="https://marketplace.visualstudio.com/items?itemName=CoenraadS.bracket-pair-colorizer-2" target="_blank" rel="noopener noreferrer">Bracket Pair Colorizer 2</a></li>
<li><a href="https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode" target="_blank" rel="noopener noreferrer">prettier - Code formatter</a></li>
</ul>
</li>
</ul>
<h4 id="ms-edge-浏览器扩展清单" class="headerLink">
    <a href="#ms-edge-%e6%b5%8f%e8%a7%88%e5%99%a8%e6%89%a9%e5%b1%95%e6%b8%85%e5%8d%95" class="header-mark"></a>MS Edge 浏览器扩展清单</h4><div align="center" ><img src="https://img1.wlcheng.cc/images_for_blogs/20240618102738.png" alt="20240618102738" width="55%" style="box-shadow: 0 3px 6px rgba(0,0,0,0.16), 0 3px 6px rgba(0,0,0,0.23);border-radius:10px;"/><br><div style="color:orange; border-bottom: 1px solid #d9d9d9; display: inline-block; color: #777; font-size: 90%; padding: 1px;">MS Edge 浏览器扩展</div></div>
<h4 id="网站书签" class="headerLink">
    <a href="#%e7%bd%91%e7%ab%99%e4%b9%a6%e7%ad%be" class="header-mark"></a>网站书签</h4><p><a href="/bookmarks/favorites_2025_6_17.html" rel="">MS Edge 备份书签 2025.6.17</a></p>]]></description></item><item><title>Linux 服务器下 PyTorch 环境配置</title><link>https://wlcheng.cc/posts/config_linux_server_pytorch/</link><pubDate>Wed, 01 Mar 2023 16:05:36 +0100</pubDate><author><name>wlcheng</name></author><guid>https://wlcheng.cc/posts/config_linux_server_pytorch/</guid><description><![CDATA[<p>记录在 Linux 下，Miniconda3 中配置 PyTorch 环境。</p>
<h2 id="安装-miniconda" class="headerLink">
    <a href="#%e5%ae%89%e8%a3%85-miniconda" class="header-mark"></a>安装 Miniconda</h2><p><a href="https://docs.conda.io/en/latest/miniconda.html" target="_blank" rel="noopener noreferrer">Miniconda 官网</a></p>
<h3 id="下载安装包" class="headerLink">
    <a href="#%e4%b8%8b%e8%bd%bd%e5%ae%89%e8%a3%85%e5%8c%85" class="header-mark"></a>下载安装包</h3><div class="code-block highlight is-open show-line-numbers  tw-group tw-my-2">
  <div class="
    code-block-title 
    
    tw-flex 
    tw-flex-row 
    tw-justify-between 
    tw-w-full tw-bg-bgColor-secondary
    ">      
    <button 
      class="
        tw-select-none 
        tw-mx-2 
        tw-block
        group-[.is-open]:tw-rotate-90
        tw-transition-[transform] 
        tw-duration-500 
        tw-ease-in-out
        print:!tw-hidden"
      disabled
      aria-hidden="true"><svg class="icon"
    xmlns="http://www.w3.org/2000/svg" viewBox="0 0 320 512"><!-- Font Awesome Free 5.15.4 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) --><path d="M285.476 272.971L91.132 467.314c-9.373 9.373-24.569 9.373-33.941 0l-22.667-22.667c-9.357-9.357-9.375-24.522-.04-33.901L188.505 256 34.484 101.255c-9.335-9.379-9.317-24.544.04-33.901l22.667-22.667c9.373-9.373 24.569-9.373 33.941 0L285.475 239.03c9.373 9.372 9.373 24.568.001 33.941z"/></svg></button>

    <div class="code-block-title-bar tw-w-full">
      <p class="tw-select-none !tw-my-1">bash</p>
    </div>
    <div class="tw-flex">
      <button 
        class="
          line-number-button
          tw-select-none 
          tw-mx-2 
          tw-hidden 
          group-[.is-open]:tw-block 
          group-[.show-line-numbers]:tw-text-fgColor-link 
          print:!tw-hidden" 
        title="Toggle line numbers"><svg class="icon"
    xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><!-- Font Awesome Free 5.15.4 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) --><path d="M61.77 401l17.5-20.15a19.92 19.92 0 0 0 5.07-14.19v-3.31C84.34 356 80.5 352 73 352H16a8 8 0 0 0-8 8v16a8 8 0 0 0 8 8h22.83a157.41 157.41 0 0 0-11 12.31l-5.61 7c-4 5.07-5.25 10.13-2.8 14.88l1.05 1.93c3 5.76 6.29 7.88 12.25 7.88h4.73c10.33 0 15.94 2.44 15.94 9.09 0 4.72-4.2 8.22-14.36 8.22a41.54 41.54 0 0 1-15.47-3.12c-6.49-3.88-11.74-3.5-15.6 3.12l-5.59 9.31c-3.72 6.13-3.19 11.72 2.63 15.94 7.71 4.69 20.38 9.44 37 9.44 34.16 0 48.5-22.75 48.5-44.12-.03-14.38-9.12-29.76-28.73-34.88zM496 224H176a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16h320a16 16 0 0 0 16-16v-32a16 16 0 0 0-16-16zm0-160H176a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16h320a16 16 0 0 0 16-16V80a16 16 0 0 0-16-16zm0 320H176a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16h320a16 16 0 0 0 16-16v-32a16 16 0 0 0-16-16zM16 160h64a8 8 0 0 0 8-8v-16a8 8 0 0 0-8-8H64V40a8 8 0 0 0-8-8H32a8 8 0 0 0-7.14 4.42l-8 16A8 8 0 0 0 24 64h8v64H16a8 8 0 0 0-8 8v16a8 8 0 0 0 8 8zm-3.91 160H80a8 8 0 0 0 8-8v-16a8 8 0 0 0-8-8H41.32c3.29-10.29 48.34-18.68 48.34-56.44 0-29.06-25-39.56-44.47-39.56-21.36 0-33.8 10-40.46 18.75-4.37 5.59-3 10.84 2.8 15.37l8.58 6.88c5.61 4.56 11 2.47 16.12-2.44a13.44 13.44 0 0 1 9.46-3.84c3.33 0 9.28 1.56 9.28 8.75C51 248.19 0 257.31 0 304.59v4C0 316 5.08 320 12.09 320z"/></svg></button>

      <button 
        class="
          wrap-code-button
          tw-select-none 
          tw-mx-2 
          tw-hidden 
          group-[.is-open]:tw-block 
          group-[.is-wrap]:tw-text-fgColor-link 
          print:!tw-hidden" 
        title="Toggle code wrap"><svg class="icon"
    xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><!-- Font Awesome Free 5.15.4 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) --><path d="M16 132h416c8.837 0 16-7.163 16-16V76c0-8.837-7.163-16-16-16H16C7.163 60 0 67.163 0 76v40c0 8.837 7.163 16 16 16zm0 160h416c8.837 0 16-7.163 16-16v-40c0-8.837-7.163-16-16-16H16c-8.837 0-16 7.163-16 16v40c0 8.837 7.163 16 16 16zm0 160h416c8.837 0 16-7.163 16-16v-40c0-8.837-7.163-16-16-16H16c-8.837 0-16 7.163-16 16v40c0 8.837 7.163 16 16 16z"/></svg></button>
      
      <button 
        class="
          copy-code-button
          tw-select-none
          tw-mx-2 
          tw-hidden
          group-[.is-open]:tw-block
          hover:tw-text-fgColor-link 
          print:!tw-hidden"
        title="Copy code">
          <span class="copy-icon tw-block"><svg class="icon"
    xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><!-- Font Awesome Free 5.15.4 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) --><path d="M433.941 65.941l-51.882-51.882A48 48 0 0 0 348.118 0H176c-26.51 0-48 21.49-48 48v48H48c-26.51 0-48 21.49-48 48v320c0 26.51 21.49 48 48 48h224c26.51 0 48-21.49 48-48v-48h80c26.51 0 48-21.49 48-48V99.882a48 48 0 0 0-14.059-33.941zM266 464H54a6 6 0 0 1-6-6V150a6 6 0 0 1 6-6h74v224c0 26.51 21.49 48 48 48h96v42a6 6 0 0 1-6 6zm128-96H182a6 6 0 0 1-6-6V54a6 6 0 0 1 6-6h106v88c0 13.255 10.745 24 24 24h88v202a6 6 0 0 1-6 6zm6-256h-64V48h9.632c1.591 0 3.117.632 4.243 1.757l48.368 48.368a6 6 0 0 1 1.757 4.243V112z"/></svg></span>
          <span class="check-icon tw-hidden"><svg class="icon"
    xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><!-- Font Awesome Free 5.15.4 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) --><path d="M173.898 439.404l-166.4-166.4c-9.997-9.997-9.997-26.206 0-36.204l36.203-36.204c9.997-9.998 26.207-9.998 36.204 0L192 312.69 432.095 72.596c9.997-9.997 26.207-9.997 36.204 0l36.203 36.204c9.997 9.997 9.997 26.206 0 36.204l-294.4 294.401c-9.998 9.997-26.207 9.997-36.204-.001z"/></svg></span>
      </button>
        
      <button 
        class="
          tw-select-none 
          tw-mx-2 
          tw-block 
          group-[.is-open]:tw-hidden 
          print:!tw-hidden" 
        disabled
        aria-hidden="true"><svg class="icon"
    xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><!-- Font Awesome Free 5.15.4 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) --><path d="M328 256c0 39.8-32.2 72-72 72s-72-32.2-72-72 32.2-72 72-72 72 32.2 72 72zm104-72c-39.8 0-72 32.2-72 72s32.2 72 72 72 72-32.2 72-72-32.2-72-72-72zm-352 0c-39.8 0-72 32.2-72 72s32.2 72 72 72 72-32.2 72-72-32.2-72-72-72z"/></svg></button>
    </div>
  </div>
  <pre style="counter-reset: codeblock;" class="tw-block tw-m-0 tw-p-0"><code 
    id="codeblock-id-1" 
    class="
      chroma 
      !tw-block 
      tw-p-0
      tw-m-0
      tw-transition-[max-height] 
      tw-duration-500 
      tw-ease-in-out 
      group-[.is-closed]:!tw-max-h-0 
      group-[.is-wrap]:tw-text-wrap
      tw-overflow-y-hidden
      tw-overflow-x-auto
      tw-scrollbar-thin
      "><span class="line"><span class="cl">wget https://repo.anaconda.com/miniconda/Miniconda3-py310_23.1.0-1-Linux-x86_64.sh</span></span></code></pre>
</div>
<h3 id="执行安装" class="headerLink">
    <a href="#%e6%89%a7%e8%a1%8c%e5%ae%89%e8%a3%85" class="header-mark"></a>执行安装</h3><div class="code-block highlight is-open show-line-numbers  tw-group tw-my-2">
  <div class="
    code-block-title 
    
    tw-flex 
    tw-flex-row 
    tw-justify-between 
    tw-w-full tw-bg-bgColor-secondary
    ">      
    <button 
      class="
        tw-select-none 
        tw-mx-2 
        tw-block
        group-[.is-open]:tw-rotate-90
        tw-transition-[transform] 
        tw-duration-500 
        tw-ease-in-out
        print:!tw-hidden"
      disabled
      aria-hidden="true"><svg class="icon"
    xmlns="http://www.w3.org/2000/svg" viewBox="0 0 320 512"><!-- Font Awesome Free 5.15.4 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) --><path d="M285.476 272.971L91.132 467.314c-9.373 9.373-24.569 9.373-33.941 0l-22.667-22.667c-9.357-9.357-9.375-24.522-.04-33.901L188.505 256 34.484 101.255c-9.335-9.379-9.317-24.544.04-33.901l22.667-22.667c9.373-9.373 24.569-9.373 33.941 0L285.475 239.03c9.373 9.372 9.373 24.568.001 33.941z"/></svg></button>

    <div class="code-block-title-bar tw-w-full">
      <p class="tw-select-none !tw-my-1">bash</p>
    </div>
    <div class="tw-flex">
      <button 
        class="
          line-number-button
          tw-select-none 
          tw-mx-2 
          tw-hidden 
          group-[.is-open]:tw-block 
          group-[.show-line-numbers]:tw-text-fgColor-link 
          print:!tw-hidden" 
        title="Toggle line numbers"><svg class="icon"
    xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><!-- Font Awesome Free 5.15.4 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) --><path d="M61.77 401l17.5-20.15a19.92 19.92 0 0 0 5.07-14.19v-3.31C84.34 356 80.5 352 73 352H16a8 8 0 0 0-8 8v16a8 8 0 0 0 8 8h22.83a157.41 157.41 0 0 0-11 12.31l-5.61 7c-4 5.07-5.25 10.13-2.8 14.88l1.05 1.93c3 5.76 6.29 7.88 12.25 7.88h4.73c10.33 0 15.94 2.44 15.94 9.09 0 4.72-4.2 8.22-14.36 8.22a41.54 41.54 0 0 1-15.47-3.12c-6.49-3.88-11.74-3.5-15.6 3.12l-5.59 9.31c-3.72 6.13-3.19 11.72 2.63 15.94 7.71 4.69 20.38 9.44 37 9.44 34.16 0 48.5-22.75 48.5-44.12-.03-14.38-9.12-29.76-28.73-34.88zM496 224H176a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16h320a16 16 0 0 0 16-16v-32a16 16 0 0 0-16-16zm0-160H176a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16h320a16 16 0 0 0 16-16V80a16 16 0 0 0-16-16zm0 320H176a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16h320a16 16 0 0 0 16-16v-32a16 16 0 0 0-16-16zM16 160h64a8 8 0 0 0 8-8v-16a8 8 0 0 0-8-8H64V40a8 8 0 0 0-8-8H32a8 8 0 0 0-7.14 4.42l-8 16A8 8 0 0 0 24 64h8v64H16a8 8 0 0 0-8 8v16a8 8 0 0 0 8 8zm-3.91 160H80a8 8 0 0 0 8-8v-16a8 8 0 0 0-8-8H41.32c3.29-10.29 48.34-18.68 48.34-56.44 0-29.06-25-39.56-44.47-39.56-21.36 0-33.8 10-40.46 18.75-4.37 5.59-3 10.84 2.8 15.37l8.58 6.88c5.61 4.56 11 2.47 16.12-2.44a13.44 13.44 0 0 1 9.46-3.84c3.33 0 9.28 1.56 9.28 8.75C51 248.19 0 257.31 0 304.59v4C0 316 5.08 320 12.09 320z"/></svg></button>

      <button 
        class="
          wrap-code-button
          tw-select-none 
          tw-mx-2 
          tw-hidden 
          group-[.is-open]:tw-block 
          group-[.is-wrap]:tw-text-fgColor-link 
          print:!tw-hidden" 
        title="Toggle code wrap"><svg class="icon"
    xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><!-- Font Awesome Free 5.15.4 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) --><path d="M16 132h416c8.837 0 16-7.163 16-16V76c0-8.837-7.163-16-16-16H16C7.163 60 0 67.163 0 76v40c0 8.837 7.163 16 16 16zm0 160h416c8.837 0 16-7.163 16-16v-40c0-8.837-7.163-16-16-16H16c-8.837 0-16 7.163-16 16v40c0 8.837 7.163 16 16 16zm0 160h416c8.837 0 16-7.163 16-16v-40c0-8.837-7.163-16-16-16H16c-8.837 0-16 7.163-16 16v40c0 8.837 7.163 16 16 16z"/></svg></button>
      
      <button 
        class="
          copy-code-button
          tw-select-none
          tw-mx-2 
          tw-hidden
          group-[.is-open]:tw-block
          hover:tw-text-fgColor-link 
          print:!tw-hidden"
        title="Copy code">
          <span class="copy-icon tw-block"><svg class="icon"
    xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><!-- Font Awesome Free 5.15.4 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) --><path d="M433.941 65.941l-51.882-51.882A48 48 0 0 0 348.118 0H176c-26.51 0-48 21.49-48 48v48H48c-26.51 0-48 21.49-48 48v320c0 26.51 21.49 48 48 48h224c26.51 0 48-21.49 48-48v-48h80c26.51 0 48-21.49 48-48V99.882a48 48 0 0 0-14.059-33.941zM266 464H54a6 6 0 0 1-6-6V150a6 6 0 0 1 6-6h74v224c0 26.51 21.49 48 48 48h96v42a6 6 0 0 1-6 6zm128-96H182a6 6 0 0 1-6-6V54a6 6 0 0 1 6-6h106v88c0 13.255 10.745 24 24 24h88v202a6 6 0 0 1-6 6zm6-256h-64V48h9.632c1.591 0 3.117.632 4.243 1.757l48.368 48.368a6 6 0 0 1 1.757 4.243V112z"/></svg></span>
          <span class="check-icon tw-hidden"><svg class="icon"
    xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><!-- Font Awesome Free 5.15.4 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) --><path d="M173.898 439.404l-166.4-166.4c-9.997-9.997-9.997-26.206 0-36.204l36.203-36.204c9.997-9.998 26.207-9.998 36.204 0L192 312.69 432.095 72.596c9.997-9.997 26.207-9.997 36.204 0l36.203 36.204c9.997 9.997 9.997 26.206 0 36.204l-294.4 294.401c-9.998 9.997-26.207 9.997-36.204-.001z"/></svg></span>
      </button>
        
      <button 
        class="
          tw-select-none 
          tw-mx-2 
          tw-block 
          group-[.is-open]:tw-hidden 
          print:!tw-hidden" 
        disabled
        aria-hidden="true"><svg class="icon"
    xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><!-- Font Awesome Free 5.15.4 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) --><path d="M328 256c0 39.8-32.2 72-72 72s-72-32.2-72-72 32.2-72 72-72 72 32.2 72 72zm104-72c-39.8 0-72 32.2-72 72s32.2 72 72 72 72-32.2 72-72-32.2-72-72-72zm-352 0c-39.8 0-72 32.2-72 72s32.2 72 72 72 72-32.2 72-72-32.2-72-72-72z"/></svg></button>
    </div>
  </div>
  <pre style="counter-reset: codeblock;" class="tw-block tw-m-0 tw-p-0"><code 
    id="codeblock-id-2" 
    class="
      chroma 
      !tw-block 
      tw-p-0
      tw-m-0
      tw-transition-[max-height] 
      tw-duration-500 
      tw-ease-in-out 
      group-[.is-closed]:!tw-max-h-0 
      group-[.is-wrap]:tw-text-wrap
      tw-overflow-y-hidden
      tw-overflow-x-auto
      tw-scrollbar-thin
      "><span class="line"><span class="cl">bash Miniconda3-py310_23.1.0-1-Linux-x86_64.sh</span></span></code></pre>
</div>
<p>输入 <code>yes</code> 同意协议；然后 <code>回车</code> 采用默认安装路径，或者手动输入指定的安装路径：</p>
<div align="center" ><img src="https://img1.wlcheng.cc/images_for_blogs/20230301163116.png" alt="20230301163116" width="75%" style="box-shadow: 0 3px 6px rgba(0,0,0,0.16), 0 3px 6px rgba(0,0,0,0.23);border-radius:10px;"/></div>
<p>下面询问在打开命令行时是否自动进入 conda 的 <code>base</code> 环境：输入 <code>yes</code> 后回车，然后执行 <code>conda config --set auto_activate_base false</code> 关闭自动初始化。p.s. 这样做可以免去手动添加环境变量的过程。</p>
<div align="center" ><img src="https://img1.wlcheng.cc/images_for_blogs/20230301164006.png" alt="20230301164006" width="75%" style="box-shadow: 0 3px 6px rgba(0,0,0,0.16), 0 3px 6px rgba(0,0,0,0.23);border-radius:10px;"/></div>
<h3 id="添加软件源频道" class="headerLink">
    <a href="#%e6%b7%bb%e5%8a%a0%e8%bd%af%e4%bb%b6%e6%ba%90%e9%a2%91%e9%81%93" class="header-mark"></a>添加软件源（频道）</h3><p>为了提高软件包下载速度，我们可以通过以下命令添加镜像软件源：</p>
<div class="code-block highlight is-open show-line-numbers  tw-group tw-my-2">
  <div class="
    code-block-title 
    
    tw-flex 
    tw-flex-row 
    tw-justify-between 
    tw-w-full tw-bg-bgColor-secondary
    ">      
    <button 
      class="
        tw-select-none 
        tw-mx-2 
        tw-block
        group-[.is-open]:tw-rotate-90
        tw-transition-[transform] 
        tw-duration-500 
        tw-ease-in-out
        print:!tw-hidden"
      disabled
      aria-hidden="true"><svg class="icon"
    xmlns="http://www.w3.org/2000/svg" viewBox="0 0 320 512"><!-- Font Awesome Free 5.15.4 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) --><path d="M285.476 272.971L91.132 467.314c-9.373 9.373-24.569 9.373-33.941 0l-22.667-22.667c-9.357-9.357-9.375-24.522-.04-33.901L188.505 256 34.484 101.255c-9.335-9.379-9.317-24.544.04-33.901l22.667-22.667c9.373-9.373 24.569-9.373 33.941 0L285.475 239.03c9.373 9.372 9.373 24.568.001 33.941z"/></svg></button>

    <div class="code-block-title-bar tw-w-full">
      <p class="tw-select-none !tw-my-1">bash</p>
    </div>
    <div class="tw-flex">
      <button 
        class="
          line-number-button
          tw-select-none 
          tw-mx-2 
          tw-hidden 
          group-[.is-open]:tw-block 
          group-[.show-line-numbers]:tw-text-fgColor-link 
          print:!tw-hidden" 
        title="Toggle line numbers"><svg class="icon"
    xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><!-- Font Awesome Free 5.15.4 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) --><path d="M61.77 401l17.5-20.15a19.92 19.92 0 0 0 5.07-14.19v-3.31C84.34 356 80.5 352 73 352H16a8 8 0 0 0-8 8v16a8 8 0 0 0 8 8h22.83a157.41 157.41 0 0 0-11 12.31l-5.61 7c-4 5.07-5.25 10.13-2.8 14.88l1.05 1.93c3 5.76 6.29 7.88 12.25 7.88h4.73c10.33 0 15.94 2.44 15.94 9.09 0 4.72-4.2 8.22-14.36 8.22a41.54 41.54 0 0 1-15.47-3.12c-6.49-3.88-11.74-3.5-15.6 3.12l-5.59 9.31c-3.72 6.13-3.19 11.72 2.63 15.94 7.71 4.69 20.38 9.44 37 9.44 34.16 0 48.5-22.75 48.5-44.12-.03-14.38-9.12-29.76-28.73-34.88zM496 224H176a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16h320a16 16 0 0 0 16-16v-32a16 16 0 0 0-16-16zm0-160H176a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16h320a16 16 0 0 0 16-16V80a16 16 0 0 0-16-16zm0 320H176a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16h320a16 16 0 0 0 16-16v-32a16 16 0 0 0-16-16zM16 160h64a8 8 0 0 0 8-8v-16a8 8 0 0 0-8-8H64V40a8 8 0 0 0-8-8H32a8 8 0 0 0-7.14 4.42l-8 16A8 8 0 0 0 24 64h8v64H16a8 8 0 0 0-8 8v16a8 8 0 0 0 8 8zm-3.91 160H80a8 8 0 0 0 8-8v-16a8 8 0 0 0-8-8H41.32c3.29-10.29 48.34-18.68 48.34-56.44 0-29.06-25-39.56-44.47-39.56-21.36 0-33.8 10-40.46 18.75-4.37 5.59-3 10.84 2.8 15.37l8.58 6.88c5.61 4.56 11 2.47 16.12-2.44a13.44 13.44 0 0 1 9.46-3.84c3.33 0 9.28 1.56 9.28 8.75C51 248.19 0 257.31 0 304.59v4C0 316 5.08 320 12.09 320z"/></svg></button>

      <button 
        class="
          wrap-code-button
          tw-select-none 
          tw-mx-2 
          tw-hidden 
          group-[.is-open]:tw-block 
          group-[.is-wrap]:tw-text-fgColor-link 
          print:!tw-hidden" 
        title="Toggle code wrap"><svg class="icon"
    xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><!-- Font Awesome Free 5.15.4 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) --><path d="M16 132h416c8.837 0 16-7.163 16-16V76c0-8.837-7.163-16-16-16H16C7.163 60 0 67.163 0 76v40c0 8.837 7.163 16 16 16zm0 160h416c8.837 0 16-7.163 16-16v-40c0-8.837-7.163-16-16-16H16c-8.837 0-16 7.163-16 16v40c0 8.837 7.163 16 16 16zm0 160h416c8.837 0 16-7.163 16-16v-40c0-8.837-7.163-16-16-16H16c-8.837 0-16 7.163-16 16v40c0 8.837 7.163 16 16 16z"/></svg></button>
      
      <button 
        class="
          copy-code-button
          tw-select-none
          tw-mx-2 
          tw-hidden
          group-[.is-open]:tw-block
          hover:tw-text-fgColor-link 
          print:!tw-hidden"
        title="Copy code">
          <span class="copy-icon tw-block"><svg class="icon"
    xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><!-- Font Awesome Free 5.15.4 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) --><path d="M433.941 65.941l-51.882-51.882A48 48 0 0 0 348.118 0H176c-26.51 0-48 21.49-48 48v48H48c-26.51 0-48 21.49-48 48v320c0 26.51 21.49 48 48 48h224c26.51 0 48-21.49 48-48v-48h80c26.51 0 48-21.49 48-48V99.882a48 48 0 0 0-14.059-33.941zM266 464H54a6 6 0 0 1-6-6V150a6 6 0 0 1 6-6h74v224c0 26.51 21.49 48 48 48h96v42a6 6 0 0 1-6 6zm128-96H182a6 6 0 0 1-6-6V54a6 6 0 0 1 6-6h106v88c0 13.255 10.745 24 24 24h88v202a6 6 0 0 1-6 6zm6-256h-64V48h9.632c1.591 0 3.117.632 4.243 1.757l48.368 48.368a6 6 0 0 1 1.757 4.243V112z"/></svg></span>
          <span class="check-icon tw-hidden"><svg class="icon"
    xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><!-- Font Awesome Free 5.15.4 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) --><path d="M173.898 439.404l-166.4-166.4c-9.997-9.997-9.997-26.206 0-36.204l36.203-36.204c9.997-9.998 26.207-9.998 36.204 0L192 312.69 432.095 72.596c9.997-9.997 26.207-9.997 36.204 0l36.203 36.204c9.997 9.997 9.997 26.206 0 36.204l-294.4 294.401c-9.998 9.997-26.207 9.997-36.204-.001z"/></svg></span>
      </button>
        
      <button 
        class="
          tw-select-none 
          tw-mx-2 
          tw-block 
          group-[.is-open]:tw-hidden 
          print:!tw-hidden" 
        disabled
        aria-hidden="true"><svg class="icon"
    xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><!-- Font Awesome Free 5.15.4 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) --><path d="M328 256c0 39.8-32.2 72-72 72s-72-32.2-72-72 32.2-72 72-72 72 32.2 72 72zm104-72c-39.8 0-72 32.2-72 72s32.2 72 72 72 72-32.2 72-72-32.2-72-72-72zm-352 0c-39.8 0-72 32.2-72 72s32.2 72 72 72 72-32.2 72-72-32.2-72-72-72z"/></svg></button>
    </div>
  </div>
  <pre style="counter-reset: codeblock;" class="tw-block tw-m-0 tw-p-0"><code 
    id="codeblock-id-3" 
    class="
      chroma 
      !tw-block 
      tw-p-0
      tw-m-0
      tw-transition-[max-height] 
      tw-duration-500 
      tw-ease-in-out 
      group-[.is-closed]:!tw-max-h-0 
      group-[.is-wrap]:tw-text-wrap
      tw-overflow-y-hidden
      tw-overflow-x-auto
      tw-scrollbar-thin
      "><span class="line"><span class="cl"><span class="c1"># 新加源具有高优先级</span>
</span></span><span class="line"><span class="cl">conda config --add channels source_url
</span></span><span class="line"><span class="cl">conda config --prepend channels source_url <span class="c1">#同上等效</span>
</span></span><span class="line"><span class="cl"><span class="c1"># 新加源具有低优先级</span>
</span></span><span class="line"><span class="cl">conda config --append channels source_url</span></span></code></pre>
</div>
<p>执行以下命令，添加清华源：</p>
<div class="code-block highlight is-open show-line-numbers  tw-group tw-my-2">
  <div class="
    code-block-title 
    
    tw-flex 
    tw-flex-row 
    tw-justify-between 
    tw-w-full tw-bg-bgColor-secondary
    ">      
    <button 
      class="
        tw-select-none 
        tw-mx-2 
        tw-block
        group-[.is-open]:tw-rotate-90
        tw-transition-[transform] 
        tw-duration-500 
        tw-ease-in-out
        print:!tw-hidden"
      disabled
      aria-hidden="true"><svg class="icon"
    xmlns="http://www.w3.org/2000/svg" viewBox="0 0 320 512"><!-- Font Awesome Free 5.15.4 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) --><path d="M285.476 272.971L91.132 467.314c-9.373 9.373-24.569 9.373-33.941 0l-22.667-22.667c-9.357-9.357-9.375-24.522-.04-33.901L188.505 256 34.484 101.255c-9.335-9.379-9.317-24.544.04-33.901l22.667-22.667c9.373-9.373 24.569-9.373 33.941 0L285.475 239.03c9.373 9.372 9.373 24.568.001 33.941z"/></svg></button>

    <div class="code-block-title-bar tw-w-full">
      <p class="tw-select-none !tw-my-1">bash</p>
    </div>
    <div class="tw-flex">
      <button 
        class="
          line-number-button
          tw-select-none 
          tw-mx-2 
          tw-hidden 
          group-[.is-open]:tw-block 
          group-[.show-line-numbers]:tw-text-fgColor-link 
          print:!tw-hidden" 
        title="Toggle line numbers"><svg class="icon"
    xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><!-- Font Awesome Free 5.15.4 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) --><path d="M61.77 401l17.5-20.15a19.92 19.92 0 0 0 5.07-14.19v-3.31C84.34 356 80.5 352 73 352H16a8 8 0 0 0-8 8v16a8 8 0 0 0 8 8h22.83a157.41 157.41 0 0 0-11 12.31l-5.61 7c-4 5.07-5.25 10.13-2.8 14.88l1.05 1.93c3 5.76 6.29 7.88 12.25 7.88h4.73c10.33 0 15.94 2.44 15.94 9.09 0 4.72-4.2 8.22-14.36 8.22a41.54 41.54 0 0 1-15.47-3.12c-6.49-3.88-11.74-3.5-15.6 3.12l-5.59 9.31c-3.72 6.13-3.19 11.72 2.63 15.94 7.71 4.69 20.38 9.44 37 9.44 34.16 0 48.5-22.75 48.5-44.12-.03-14.38-9.12-29.76-28.73-34.88zM496 224H176a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16h320a16 16 0 0 0 16-16v-32a16 16 0 0 0-16-16zm0-160H176a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16h320a16 16 0 0 0 16-16V80a16 16 0 0 0-16-16zm0 320H176a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16h320a16 16 0 0 0 16-16v-32a16 16 0 0 0-16-16zM16 160h64a8 8 0 0 0 8-8v-16a8 8 0 0 0-8-8H64V40a8 8 0 0 0-8-8H32a8 8 0 0 0-7.14 4.42l-8 16A8 8 0 0 0 24 64h8v64H16a8 8 0 0 0-8 8v16a8 8 0 0 0 8 8zm-3.91 160H80a8 8 0 0 0 8-8v-16a8 8 0 0 0-8-8H41.32c3.29-10.29 48.34-18.68 48.34-56.44 0-29.06-25-39.56-44.47-39.56-21.36 0-33.8 10-40.46 18.75-4.37 5.59-3 10.84 2.8 15.37l8.58 6.88c5.61 4.56 11 2.47 16.12-2.44a13.44 13.44 0 0 1 9.46-3.84c3.33 0 9.28 1.56 9.28 8.75C51 248.19 0 257.31 0 304.59v4C0 316 5.08 320 12.09 320z"/></svg></button>

      <button 
        class="
          wrap-code-button
          tw-select-none 
          tw-mx-2 
          tw-hidden 
          group-[.is-open]:tw-block 
          group-[.is-wrap]:tw-text-fgColor-link 
          print:!tw-hidden" 
        title="Toggle code wrap"><svg class="icon"
    xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><!-- Font Awesome Free 5.15.4 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) --><path d="M16 132h416c8.837 0 16-7.163 16-16V76c0-8.837-7.163-16-16-16H16C7.163 60 0 67.163 0 76v40c0 8.837 7.163 16 16 16zm0 160h416c8.837 0 16-7.163 16-16v-40c0-8.837-7.163-16-16-16H16c-8.837 0-16 7.163-16 16v40c0 8.837 7.163 16 16 16zm0 160h416c8.837 0 16-7.163 16-16v-40c0-8.837-7.163-16-16-16H16c-8.837 0-16 7.163-16 16v40c0 8.837 7.163 16 16 16z"/></svg></button>
      
      <button 
        class="
          copy-code-button
          tw-select-none
          tw-mx-2 
          tw-hidden
          group-[.is-open]:tw-block
          hover:tw-text-fgColor-link 
          print:!tw-hidden"
        title="Copy code">
          <span class="copy-icon tw-block"><svg class="icon"
    xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><!-- Font Awesome Free 5.15.4 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) --><path d="M433.941 65.941l-51.882-51.882A48 48 0 0 0 348.118 0H176c-26.51 0-48 21.49-48 48v48H48c-26.51 0-48 21.49-48 48v320c0 26.51 21.49 48 48 48h224c26.51 0 48-21.49 48-48v-48h80c26.51 0 48-21.49 48-48V99.882a48 48 0 0 0-14.059-33.941zM266 464H54a6 6 0 0 1-6-6V150a6 6 0 0 1 6-6h74v224c0 26.51 21.49 48 48 48h96v42a6 6 0 0 1-6 6zm128-96H182a6 6 0 0 1-6-6V54a6 6 0 0 1 6-6h106v88c0 13.255 10.745 24 24 24h88v202a6 6 0 0 1-6 6zm6-256h-64V48h9.632c1.591 0 3.117.632 4.243 1.757l48.368 48.368a6 6 0 0 1 1.757 4.243V112z"/></svg></span>
          <span class="check-icon tw-hidden"><svg class="icon"
    xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><!-- Font Awesome Free 5.15.4 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) --><path d="M173.898 439.404l-166.4-166.4c-9.997-9.997-9.997-26.206 0-36.204l36.203-36.204c9.997-9.998 26.207-9.998 36.204 0L192 312.69 432.095 72.596c9.997-9.997 26.207-9.997 36.204 0l36.203 36.204c9.997 9.997 9.997 26.206 0 36.204l-294.4 294.401c-9.998 9.997-26.207 9.997-36.204-.001z"/></svg></span>
      </button>
        
      <button 
        class="
          tw-select-none 
          tw-mx-2 
          tw-block 
          group-[.is-open]:tw-hidden 
          print:!tw-hidden" 
        disabled
        aria-hidden="true"><svg class="icon"
    xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><!-- Font Awesome Free 5.15.4 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) --><path d="M328 256c0 39.8-32.2 72-72 72s-72-32.2-72-72 32.2-72 72-72 72 32.2 72 72zm104-72c-39.8 0-72 32.2-72 72s32.2 72 72 72 72-32.2 72-72-32.2-72-72-72zm-352 0c-39.8 0-72 32.2-72 72s32.2 72 72 72 72-32.2 72-72-32.2-72-72-72z"/></svg></button>
    </div>
  </div>
  <pre style="counter-reset: codeblock;" class="tw-block tw-m-0 tw-p-0"><code 
    id="codeblock-id-4" 
    class="
      chroma 
      !tw-block 
      tw-p-0
      tw-m-0
      tw-transition-[max-height] 
      tw-duration-500 
      tw-ease-in-out 
      group-[.is-closed]:!tw-max-h-0 
      group-[.is-wrap]:tw-text-wrap
      tw-overflow-y-hidden
      tw-overflow-x-auto
      tw-scrollbar-thin
      "><span class="line"><span class="cl">conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
</span></span><span class="line"><span class="cl">conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/
</span></span><span class="line"><span class="cl">conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge/
</span></span><span class="line"><span class="cl">conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/bioconda/</span></span></code></pre>
</div>
<p>查看源是否添加成功：</p>
<div class="code-block highlight is-open show-line-numbers  tw-group tw-my-2">
  <div class="
    code-block-title 
    
    tw-flex 
    tw-flex-row 
    tw-justify-between 
    tw-w-full tw-bg-bgColor-secondary
    ">      
    <button 
      class="
        tw-select-none 
        tw-mx-2 
        tw-block
        group-[.is-open]:tw-rotate-90
        tw-transition-[transform] 
        tw-duration-500 
        tw-ease-in-out
        print:!tw-hidden"
      disabled
      aria-hidden="true"><svg class="icon"
    xmlns="http://www.w3.org/2000/svg" viewBox="0 0 320 512"><!-- Font Awesome Free 5.15.4 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) --><path d="M285.476 272.971L91.132 467.314c-9.373 9.373-24.569 9.373-33.941 0l-22.667-22.667c-9.357-9.357-9.375-24.522-.04-33.901L188.505 256 34.484 101.255c-9.335-9.379-9.317-24.544.04-33.901l22.667-22.667c9.373-9.373 24.569-9.373 33.941 0L285.475 239.03c9.373 9.372 9.373 24.568.001 33.941z"/></svg></button>

    <div class="code-block-title-bar tw-w-full">
      <p class="tw-select-none !tw-my-1">bash</p>
    </div>
    <div class="tw-flex">
      <button 
        class="
          line-number-button
          tw-select-none 
          tw-mx-2 
          tw-hidden 
          group-[.is-open]:tw-block 
          group-[.show-line-numbers]:tw-text-fgColor-link 
          print:!tw-hidden" 
        title="Toggle line numbers"><svg class="icon"
    xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><!-- Font Awesome Free 5.15.4 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) --><path d="M61.77 401l17.5-20.15a19.92 19.92 0 0 0 5.07-14.19v-3.31C84.34 356 80.5 352 73 352H16a8 8 0 0 0-8 8v16a8 8 0 0 0 8 8h22.83a157.41 157.41 0 0 0-11 12.31l-5.61 7c-4 5.07-5.25 10.13-2.8 14.88l1.05 1.93c3 5.76 6.29 7.88 12.25 7.88h4.73c10.33 0 15.94 2.44 15.94 9.09 0 4.72-4.2 8.22-14.36 8.22a41.54 41.54 0 0 1-15.47-3.12c-6.49-3.88-11.74-3.5-15.6 3.12l-5.59 9.31c-3.72 6.13-3.19 11.72 2.63 15.94 7.71 4.69 20.38 9.44 37 9.44 34.16 0 48.5-22.75 48.5-44.12-.03-14.38-9.12-29.76-28.73-34.88zM496 224H176a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16h320a16 16 0 0 0 16-16v-32a16 16 0 0 0-16-16zm0-160H176a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16h320a16 16 0 0 0 16-16V80a16 16 0 0 0-16-16zm0 320H176a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16h320a16 16 0 0 0 16-16v-32a16 16 0 0 0-16-16zM16 160h64a8 8 0 0 0 8-8v-16a8 8 0 0 0-8-8H64V40a8 8 0 0 0-8-8H32a8 8 0 0 0-7.14 4.42l-8 16A8 8 0 0 0 24 64h8v64H16a8 8 0 0 0-8 8v16a8 8 0 0 0 8 8zm-3.91 160H80a8 8 0 0 0 8-8v-16a8 8 0 0 0-8-8H41.32c3.29-10.29 48.34-18.68 48.34-56.44 0-29.06-25-39.56-44.47-39.56-21.36 0-33.8 10-40.46 18.75-4.37 5.59-3 10.84 2.8 15.37l8.58 6.88c5.61 4.56 11 2.47 16.12-2.44a13.44 13.44 0 0 1 9.46-3.84c3.33 0 9.28 1.56 9.28 8.75C51 248.19 0 257.31 0 304.59v4C0 316 5.08 320 12.09 320z"/></svg></button>

      <button 
        class="
          wrap-code-button
          tw-select-none 
          tw-mx-2 
          tw-hidden 
          group-[.is-open]:tw-block 
          group-[.is-wrap]:tw-text-fgColor-link 
          print:!tw-hidden" 
        title="Toggle code wrap"><svg class="icon"
    xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><!-- Font Awesome Free 5.15.4 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) --><path d="M16 132h416c8.837 0 16-7.163 16-16V76c0-8.837-7.163-16-16-16H16C7.163 60 0 67.163 0 76v40c0 8.837 7.163 16 16 16zm0 160h416c8.837 0 16-7.163 16-16v-40c0-8.837-7.163-16-16-16H16c-8.837 0-16 7.163-16 16v40c0 8.837 7.163 16 16 16zm0 160h416c8.837 0 16-7.163 16-16v-40c0-8.837-7.163-16-16-16H16c-8.837 0-16 7.163-16 16v40c0 8.837 7.163 16 16 16z"/></svg></button>
      
      <button 
        class="
          copy-code-button
          tw-select-none
          tw-mx-2 
          tw-hidden
          group-[.is-open]:tw-block
          hover:tw-text-fgColor-link 
          print:!tw-hidden"
        title="Copy code">
          <span class="copy-icon tw-block"><svg class="icon"
    xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><!-- Font Awesome Free 5.15.4 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) --><path d="M433.941 65.941l-51.882-51.882A48 48 0 0 0 348.118 0H176c-26.51 0-48 21.49-48 48v48H48c-26.51 0-48 21.49-48 48v320c0 26.51 21.49 48 48 48h224c26.51 0 48-21.49 48-48v-48h80c26.51 0 48-21.49 48-48V99.882a48 48 0 0 0-14.059-33.941zM266 464H54a6 6 0 0 1-6-6V150a6 6 0 0 1 6-6h74v224c0 26.51 21.49 48 48 48h96v42a6 6 0 0 1-6 6zm128-96H182a6 6 0 0 1-6-6V54a6 6 0 0 1 6-6h106v88c0 13.255 10.745 24 24 24h88v202a6 6 0 0 1-6 6zm6-256h-64V48h9.632c1.591 0 3.117.632 4.243 1.757l48.368 48.368a6 6 0 0 1 1.757 4.243V112z"/></svg></span>
          <span class="check-icon tw-hidden"><svg class="icon"
    xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><!-- Font Awesome Free 5.15.4 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) --><path d="M173.898 439.404l-166.4-166.4c-9.997-9.997-9.997-26.206 0-36.204l36.203-36.204c9.997-9.998 26.207-9.998 36.204 0L192 312.69 432.095 72.596c9.997-9.997 26.207-9.997 36.204 0l36.203 36.204c9.997 9.997 9.997 26.206 0 36.204l-294.4 294.401c-9.998 9.997-26.207 9.997-36.204-.001z"/></svg></span>
      </button>
        
      <button 
        class="
          tw-select-none 
          tw-mx-2 
          tw-block 
          group-[.is-open]:tw-hidden 
          print:!tw-hidden" 
        disabled
        aria-hidden="true"><svg class="icon"
    xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><!-- Font Awesome Free 5.15.4 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) --><path d="M328 256c0 39.8-32.2 72-72 72s-72-32.2-72-72 32.2-72 72-72 72 32.2 72 72zm104-72c-39.8 0-72 32.2-72 72s32.2 72 72 72 72-32.2 72-72-32.2-72-72-72zm-352 0c-39.8 0-72 32.2-72 72s32.2 72 72 72 72-32.2 72-72-32.2-72-72-72z"/></svg></button>
    </div>
  </div>
  <pre style="counter-reset: codeblock;" class="tw-block tw-m-0 tw-p-0"><code 
    id="codeblock-id-5" 
    class="
      chroma 
      !tw-block 
      tw-p-0
      tw-m-0
      tw-transition-[max-height] 
      tw-duration-500 
      tw-ease-in-out 
      group-[.is-closed]:!tw-max-h-0 
      group-[.is-wrap]:tw-text-wrap
      tw-overflow-y-hidden
      tw-overflow-x-auto
      tw-scrollbar-thin
      "><span class="line"><span class="cl">conda config --get channels</span></span></code></pre>
</div>
<p><strong>参考：</strong></p>
<p>[1] 朱渠成, Linux 下 miniconda 的安装使用, <a href="https://www.jianshu.com/p/4d4c786ed454" target="_blank" rel="noopener noreferrer">https://www.jianshu.com/p/4d4c786ed454</a></p>
<p>[2] Conda doc, Managing channels, <a href="https://docs.conda.io/projects/conda/en/latest/user-guide/tasks/manage-channels.html?highlight=priority" target="_blank" rel="noopener noreferrer">https://docs.conda.io/projects/conda/en/latest/user-guide/tasks/manage-channels.html?highlight=priority</a></p>
<p>[3] 普遍语法, 编辑 condarc 编辑 channel 的优先级, <a href="https://blog.csdn.net/weixin_45564533/article/details/123012930" target="_blank" rel="noopener noreferrer">https://blog.csdn.net/weixin_45564533/article/details/123012930</a></p>
<h2 id="创建-pytorch-虚拟环境" class="headerLink">
    <a href="#%e5%88%9b%e5%bb%ba-pytorch-%e8%99%9a%e6%8b%9f%e7%8e%af%e5%a2%83" class="header-mark"></a>创建 PyTorch 虚拟环境</h2><h3 id="创建-conda-独立环境" class="headerLink">
    <a href="#%e5%88%9b%e5%bb%ba-conda-%e7%8b%ac%e7%ab%8b%e7%8e%af%e5%a2%83" class="header-mark"></a>创建 conda 独立环境</h3><div class="code-block highlight is-open show-line-numbers  tw-group tw-my-2">
  <div class="
    code-block-title 
    
    tw-flex 
    tw-flex-row 
    tw-justify-between 
    tw-w-full tw-bg-bgColor-secondary
    ">      
    <button 
      class="
        tw-select-none 
        tw-mx-2 
        tw-block
        group-[.is-open]:tw-rotate-90
        tw-transition-[transform] 
        tw-duration-500 
        tw-ease-in-out
        print:!tw-hidden"
      disabled
      aria-hidden="true"><svg class="icon"
    xmlns="http://www.w3.org/2000/svg" viewBox="0 0 320 512"><!-- Font Awesome Free 5.15.4 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) --><path d="M285.476 272.971L91.132 467.314c-9.373 9.373-24.569 9.373-33.941 0l-22.667-22.667c-9.357-9.357-9.375-24.522-.04-33.901L188.505 256 34.484 101.255c-9.335-9.379-9.317-24.544.04-33.901l22.667-22.667c9.373-9.373 24.569-9.373 33.941 0L285.475 239.03c9.373 9.372 9.373 24.568.001 33.941z"/></svg></button>

    <div class="code-block-title-bar tw-w-full">
      <p class="tw-select-none !tw-my-1">bash</p>
    </div>
    <div class="tw-flex">
      <button 
        class="
          line-number-button
          tw-select-none 
          tw-mx-2 
          tw-hidden 
          group-[.is-open]:tw-block 
          group-[.show-line-numbers]:tw-text-fgColor-link 
          print:!tw-hidden" 
        title="Toggle line numbers"><svg class="icon"
    xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><!-- Font Awesome Free 5.15.4 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) --><path d="M61.77 401l17.5-20.15a19.92 19.92 0 0 0 5.07-14.19v-3.31C84.34 356 80.5 352 73 352H16a8 8 0 0 0-8 8v16a8 8 0 0 0 8 8h22.83a157.41 157.41 0 0 0-11 12.31l-5.61 7c-4 5.07-5.25 10.13-2.8 14.88l1.05 1.93c3 5.76 6.29 7.88 12.25 7.88h4.73c10.33 0 15.94 2.44 15.94 9.09 0 4.72-4.2 8.22-14.36 8.22a41.54 41.54 0 0 1-15.47-3.12c-6.49-3.88-11.74-3.5-15.6 3.12l-5.59 9.31c-3.72 6.13-3.19 11.72 2.63 15.94 7.71 4.69 20.38 9.44 37 9.44 34.16 0 48.5-22.75 48.5-44.12-.03-14.38-9.12-29.76-28.73-34.88zM496 224H176a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16h320a16 16 0 0 0 16-16v-32a16 16 0 0 0-16-16zm0-160H176a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16h320a16 16 0 0 0 16-16V80a16 16 0 0 0-16-16zm0 320H176a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16h320a16 16 0 0 0 16-16v-32a16 16 0 0 0-16-16zM16 160h64a8 8 0 0 0 8-8v-16a8 8 0 0 0-8-8H64V40a8 8 0 0 0-8-8H32a8 8 0 0 0-7.14 4.42l-8 16A8 8 0 0 0 24 64h8v64H16a8 8 0 0 0-8 8v16a8 8 0 0 0 8 8zm-3.91 160H80a8 8 0 0 0 8-8v-16a8 8 0 0 0-8-8H41.32c3.29-10.29 48.34-18.68 48.34-56.44 0-29.06-25-39.56-44.47-39.56-21.36 0-33.8 10-40.46 18.75-4.37 5.59-3 10.84 2.8 15.37l8.58 6.88c5.61 4.56 11 2.47 16.12-2.44a13.44 13.44 0 0 1 9.46-3.84c3.33 0 9.28 1.56 9.28 8.75C51 248.19 0 257.31 0 304.59v4C0 316 5.08 320 12.09 320z"/></svg></button>

      <button 
        class="
          wrap-code-button
          tw-select-none 
          tw-mx-2 
          tw-hidden 
          group-[.is-open]:tw-block 
          group-[.is-wrap]:tw-text-fgColor-link 
          print:!tw-hidden" 
        title="Toggle code wrap"><svg class="icon"
    xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><!-- Font Awesome Free 5.15.4 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) --><path d="M16 132h416c8.837 0 16-7.163 16-16V76c0-8.837-7.163-16-16-16H16C7.163 60 0 67.163 0 76v40c0 8.837 7.163 16 16 16zm0 160h416c8.837 0 16-7.163 16-16v-40c0-8.837-7.163-16-16-16H16c-8.837 0-16 7.163-16 16v40c0 8.837 7.163 16 16 16zm0 160h416c8.837 0 16-7.163 16-16v-40c0-8.837-7.163-16-16-16H16c-8.837 0-16 7.163-16 16v40c0 8.837 7.163 16 16 16z"/></svg></button>
      
      <button 
        class="
          copy-code-button
          tw-select-none
          tw-mx-2 
          tw-hidden
          group-[.is-open]:tw-block
          hover:tw-text-fgColor-link 
          print:!tw-hidden"
        title="Copy code">
          <span class="copy-icon tw-block"><svg class="icon"
    xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><!-- Font Awesome Free 5.15.4 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) --><path d="M433.941 65.941l-51.882-51.882A48 48 0 0 0 348.118 0H176c-26.51 0-48 21.49-48 48v48H48c-26.51 0-48 21.49-48 48v320c0 26.51 21.49 48 48 48h224c26.51 0 48-21.49 48-48v-48h80c26.51 0 48-21.49 48-48V99.882a48 48 0 0 0-14.059-33.941zM266 464H54a6 6 0 0 1-6-6V150a6 6 0 0 1 6-6h74v224c0 26.51 21.49 48 48 48h96v42a6 6 0 0 1-6 6zm128-96H182a6 6 0 0 1-6-6V54a6 6 0 0 1 6-6h106v88c0 13.255 10.745 24 24 24h88v202a6 6 0 0 1-6 6zm6-256h-64V48h9.632c1.591 0 3.117.632 4.243 1.757l48.368 48.368a6 6 0 0 1 1.757 4.243V112z"/></svg></span>
          <span class="check-icon tw-hidden"><svg class="icon"
    xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><!-- Font Awesome Free 5.15.4 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) --><path d="M173.898 439.404l-166.4-166.4c-9.997-9.997-9.997-26.206 0-36.204l36.203-36.204c9.997-9.998 26.207-9.998 36.204 0L192 312.69 432.095 72.596c9.997-9.997 26.207-9.997 36.204 0l36.203 36.204c9.997 9.997 9.997 26.206 0 36.204l-294.4 294.401c-9.998 9.997-26.207 9.997-36.204-.001z"/></svg></span>
      </button>
        
      <button 
        class="
          tw-select-none 
          tw-mx-2 
          tw-block 
          group-[.is-open]:tw-hidden 
          print:!tw-hidden" 
        disabled
        aria-hidden="true"><svg class="icon"
    xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><!-- Font Awesome Free 5.15.4 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) --><path d="M328 256c0 39.8-32.2 72-72 72s-72-32.2-72-72 32.2-72 72-72 72 32.2 72 72zm104-72c-39.8 0-72 32.2-72 72s32.2 72 72 72 72-32.2 72-72-32.2-72-72-72zm-352 0c-39.8 0-72 32.2-72 72s32.2 72 72 72 72-32.2 72-72-32.2-72-72-72z"/></svg></button>
    </div>
  </div>
  <pre style="counter-reset: codeblock;" class="tw-block tw-m-0 tw-p-0"><code 
    id="codeblock-id-6" 
    class="
      chroma 
      !tw-block 
      tw-p-0
      tw-m-0
      tw-transition-[max-height] 
      tw-duration-500 
      tw-ease-in-out 
      group-[.is-closed]:!tw-max-h-0 
      group-[.is-wrap]:tw-text-wrap
      tw-overflow-y-hidden
      tw-overflow-x-auto
      tw-scrollbar-thin
      "><span class="line"><span class="cl">conda create -n pt <span class="nv">python</span><span class="o">=</span>3.10</span></span></code></pre>
</div>
<h3 id="配置-pytorch-环境" class="headerLink">
    <a href="#%e9%85%8d%e7%bd%ae-pytorch-%e7%8e%af%e5%a2%83" class="header-mark"></a>配置 PyTorch 环境</h3><p>进入创建的环境 <code>pt</code>：</p>
<div class="code-block highlight is-open show-line-numbers  tw-group tw-my-2">
  <div class="
    code-block-title 
    
    tw-flex 
    tw-flex-row 
    tw-justify-between 
    tw-w-full tw-bg-bgColor-secondary
    ">      
    <button 
      class="
        tw-select-none 
        tw-mx-2 
        tw-block
        group-[.is-open]:tw-rotate-90
        tw-transition-[transform] 
        tw-duration-500 
        tw-ease-in-out
        print:!tw-hidden"
      disabled
      aria-hidden="true"><svg class="icon"
    xmlns="http://www.w3.org/2000/svg" viewBox="0 0 320 512"><!-- Font Awesome Free 5.15.4 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) --><path d="M285.476 272.971L91.132 467.314c-9.373 9.373-24.569 9.373-33.941 0l-22.667-22.667c-9.357-9.357-9.375-24.522-.04-33.901L188.505 256 34.484 101.255c-9.335-9.379-9.317-24.544.04-33.901l22.667-22.667c9.373-9.373 24.569-9.373 33.941 0L285.475 239.03c9.373 9.372 9.373 24.568.001 33.941z"/></svg></button>

    <div class="code-block-title-bar tw-w-full">
      <p class="tw-select-none !tw-my-1">bash</p>
    </div>
    <div class="tw-flex">
      <button 
        class="
          line-number-button
          tw-select-none 
          tw-mx-2 
          tw-hidden 
          group-[.is-open]:tw-block 
          group-[.show-line-numbers]:tw-text-fgColor-link 
          print:!tw-hidden" 
        title="Toggle line numbers"><svg class="icon"
    xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><!-- Font Awesome Free 5.15.4 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) --><path d="M61.77 401l17.5-20.15a19.92 19.92 0 0 0 5.07-14.19v-3.31C84.34 356 80.5 352 73 352H16a8 8 0 0 0-8 8v16a8 8 0 0 0 8 8h22.83a157.41 157.41 0 0 0-11 12.31l-5.61 7c-4 5.07-5.25 10.13-2.8 14.88l1.05 1.93c3 5.76 6.29 7.88 12.25 7.88h4.73c10.33 0 15.94 2.44 15.94 9.09 0 4.72-4.2 8.22-14.36 8.22a41.54 41.54 0 0 1-15.47-3.12c-6.49-3.88-11.74-3.5-15.6 3.12l-5.59 9.31c-3.72 6.13-3.19 11.72 2.63 15.94 7.71 4.69 20.38 9.44 37 9.44 34.16 0 48.5-22.75 48.5-44.12-.03-14.38-9.12-29.76-28.73-34.88zM496 224H176a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16h320a16 16 0 0 0 16-16v-32a16 16 0 0 0-16-16zm0-160H176a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16h320a16 16 0 0 0 16-16V80a16 16 0 0 0-16-16zm0 320H176a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16h320a16 16 0 0 0 16-16v-32a16 16 0 0 0-16-16zM16 160h64a8 8 0 0 0 8-8v-16a8 8 0 0 0-8-8H64V40a8 8 0 0 0-8-8H32a8 8 0 0 0-7.14 4.42l-8 16A8 8 0 0 0 24 64h8v64H16a8 8 0 0 0-8 8v16a8 8 0 0 0 8 8zm-3.91 160H80a8 8 0 0 0 8-8v-16a8 8 0 0 0-8-8H41.32c3.29-10.29 48.34-18.68 48.34-56.44 0-29.06-25-39.56-44.47-39.56-21.36 0-33.8 10-40.46 18.75-4.37 5.59-3 10.84 2.8 15.37l8.58 6.88c5.61 4.56 11 2.47 16.12-2.44a13.44 13.44 0 0 1 9.46-3.84c3.33 0 9.28 1.56 9.28 8.75C51 248.19 0 257.31 0 304.59v4C0 316 5.08 320 12.09 320z"/></svg></button>

      <button 
        class="
          wrap-code-button
          tw-select-none 
          tw-mx-2 
          tw-hidden 
          group-[.is-open]:tw-block 
          group-[.is-wrap]:tw-text-fgColor-link 
          print:!tw-hidden" 
        title="Toggle code wrap"><svg class="icon"
    xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><!-- Font Awesome Free 5.15.4 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) --><path d="M16 132h416c8.837 0 16-7.163 16-16V76c0-8.837-7.163-16-16-16H16C7.163 60 0 67.163 0 76v40c0 8.837 7.163 16 16 16zm0 160h416c8.837 0 16-7.163 16-16v-40c0-8.837-7.163-16-16-16H16c-8.837 0-16 7.163-16 16v40c0 8.837 7.163 16 16 16zm0 160h416c8.837 0 16-7.163 16-16v-40c0-8.837-7.163-16-16-16H16c-8.837 0-16 7.163-16 16v40c0 8.837 7.163 16 16 16z"/></svg></button>
      
      <button 
        class="
          copy-code-button
          tw-select-none
          tw-mx-2 
          tw-hidden
          group-[.is-open]:tw-block
          hover:tw-text-fgColor-link 
          print:!tw-hidden"
        title="Copy code">
          <span class="copy-icon tw-block"><svg class="icon"
    xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><!-- Font Awesome Free 5.15.4 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) --><path d="M433.941 65.941l-51.882-51.882A48 48 0 0 0 348.118 0H176c-26.51 0-48 21.49-48 48v48H48c-26.51 0-48 21.49-48 48v320c0 26.51 21.49 48 48 48h224c26.51 0 48-21.49 48-48v-48h80c26.51 0 48-21.49 48-48V99.882a48 48 0 0 0-14.059-33.941zM266 464H54a6 6 0 0 1-6-6V150a6 6 0 0 1 6-6h74v224c0 26.51 21.49 48 48 48h96v42a6 6 0 0 1-6 6zm128-96H182a6 6 0 0 1-6-6V54a6 6 0 0 1 6-6h106v88c0 13.255 10.745 24 24 24h88v202a6 6 0 0 1-6 6zm6-256h-64V48h9.632c1.591 0 3.117.632 4.243 1.757l48.368 48.368a6 6 0 0 1 1.757 4.243V112z"/></svg></span>
          <span class="check-icon tw-hidden"><svg class="icon"
    xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><!-- Font Awesome Free 5.15.4 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) --><path d="M173.898 439.404l-166.4-166.4c-9.997-9.997-9.997-26.206 0-36.204l36.203-36.204c9.997-9.998 26.207-9.998 36.204 0L192 312.69 432.095 72.596c9.997-9.997 26.207-9.997 36.204 0l36.203 36.204c9.997 9.997 9.997 26.206 0 36.204l-294.4 294.401c-9.998 9.997-26.207 9.997-36.204-.001z"/></svg></span>
      </button>
        
      <button 
        class="
          tw-select-none 
          tw-mx-2 
          tw-block 
          group-[.is-open]:tw-hidden 
          print:!tw-hidden" 
        disabled
        aria-hidden="true"><svg class="icon"
    xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><!-- Font Awesome Free 5.15.4 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) --><path d="M328 256c0 39.8-32.2 72-72 72s-72-32.2-72-72 32.2-72 72-72 72 32.2 72 72zm104-72c-39.8 0-72 32.2-72 72s32.2 72 72 72 72-32.2 72-72-32.2-72-72-72zm-352 0c-39.8 0-72 32.2-72 72s32.2 72 72 72 72-32.2 72-72-32.2-72-72-72z"/></svg></button>
    </div>
  </div>
  <pre style="counter-reset: codeblock;" class="tw-block tw-m-0 tw-p-0"><code 
    id="codeblock-id-7" 
    class="
      chroma 
      !tw-block 
      tw-p-0
      tw-m-0
      tw-transition-[max-height] 
      tw-duration-500 
      tw-ease-in-out 
      group-[.is-closed]:!tw-max-h-0 
      group-[.is-wrap]:tw-text-wrap
      tw-overflow-y-hidden
      tw-overflow-x-auto
      tw-scrollbar-thin
      "><span class="line"><span class="cl">conda activate pt</span></span></code></pre>
</div>
<p>通过 PyTorch <a href="https://pytorch.org/get-started/locally/" target="_blank" rel="noopener noreferrer">官网</a>，选择所需环境，获取安装命令并执行：</p>
<div class="code-block highlight is-open show-line-numbers  tw-group tw-my-2">
  <div class="
    code-block-title 
    
    tw-flex 
    tw-flex-row 
    tw-justify-between 
    tw-w-full tw-bg-bgColor-secondary
    ">      
    <button 
      class="
        tw-select-none 
        tw-mx-2 
        tw-block
        group-[.is-open]:tw-rotate-90
        tw-transition-[transform] 
        tw-duration-500 
        tw-ease-in-out
        print:!tw-hidden"
      disabled
      aria-hidden="true"><svg class="icon"
    xmlns="http://www.w3.org/2000/svg" viewBox="0 0 320 512"><!-- Font Awesome Free 5.15.4 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) --><path d="M285.476 272.971L91.132 467.314c-9.373 9.373-24.569 9.373-33.941 0l-22.667-22.667c-9.357-9.357-9.375-24.522-.04-33.901L188.505 256 34.484 101.255c-9.335-9.379-9.317-24.544.04-33.901l22.667-22.667c9.373-9.373 24.569-9.373 33.941 0L285.475 239.03c9.373 9.372 9.373 24.568.001 33.941z"/></svg></button>

    <div class="code-block-title-bar tw-w-full">
      <p class="tw-select-none !tw-my-1">bash</p>
    </div>
    <div class="tw-flex">
      <button 
        class="
          line-number-button
          tw-select-none 
          tw-mx-2 
          tw-hidden 
          group-[.is-open]:tw-block 
          group-[.show-line-numbers]:tw-text-fgColor-link 
          print:!tw-hidden" 
        title="Toggle line numbers"><svg class="icon"
    xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><!-- Font Awesome Free 5.15.4 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) --><path d="M61.77 401l17.5-20.15a19.92 19.92 0 0 0 5.07-14.19v-3.31C84.34 356 80.5 352 73 352H16a8 8 0 0 0-8 8v16a8 8 0 0 0 8 8h22.83a157.41 157.41 0 0 0-11 12.31l-5.61 7c-4 5.07-5.25 10.13-2.8 14.88l1.05 1.93c3 5.76 6.29 7.88 12.25 7.88h4.73c10.33 0 15.94 2.44 15.94 9.09 0 4.72-4.2 8.22-14.36 8.22a41.54 41.54 0 0 1-15.47-3.12c-6.49-3.88-11.74-3.5-15.6 3.12l-5.59 9.31c-3.72 6.13-3.19 11.72 2.63 15.94 7.71 4.69 20.38 9.44 37 9.44 34.16 0 48.5-22.75 48.5-44.12-.03-14.38-9.12-29.76-28.73-34.88zM496 224H176a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16h320a16 16 0 0 0 16-16v-32a16 16 0 0 0-16-16zm0-160H176a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16h320a16 16 0 0 0 16-16V80a16 16 0 0 0-16-16zm0 320H176a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16h320a16 16 0 0 0 16-16v-32a16 16 0 0 0-16-16zM16 160h64a8 8 0 0 0 8-8v-16a8 8 0 0 0-8-8H64V40a8 8 0 0 0-8-8H32a8 8 0 0 0-7.14 4.42l-8 16A8 8 0 0 0 24 64h8v64H16a8 8 0 0 0-8 8v16a8 8 0 0 0 8 8zm-3.91 160H80a8 8 0 0 0 8-8v-16a8 8 0 0 0-8-8H41.32c3.29-10.29 48.34-18.68 48.34-56.44 0-29.06-25-39.56-44.47-39.56-21.36 0-33.8 10-40.46 18.75-4.37 5.59-3 10.84 2.8 15.37l8.58 6.88c5.61 4.56 11 2.47 16.12-2.44a13.44 13.44 0 0 1 9.46-3.84c3.33 0 9.28 1.56 9.28 8.75C51 248.19 0 257.31 0 304.59v4C0 316 5.08 320 12.09 320z"/></svg></button>

      <button 
        class="
          wrap-code-button
          tw-select-none 
          tw-mx-2 
          tw-hidden 
          group-[.is-open]:tw-block 
          group-[.is-wrap]:tw-text-fgColor-link 
          print:!tw-hidden" 
        title="Toggle code wrap"><svg class="icon"
    xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><!-- Font Awesome Free 5.15.4 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) --><path d="M16 132h416c8.837 0 16-7.163 16-16V76c0-8.837-7.163-16-16-16H16C7.163 60 0 67.163 0 76v40c0 8.837 7.163 16 16 16zm0 160h416c8.837 0 16-7.163 16-16v-40c0-8.837-7.163-16-16-16H16c-8.837 0-16 7.163-16 16v40c0 8.837 7.163 16 16 16zm0 160h416c8.837 0 16-7.163 16-16v-40c0-8.837-7.163-16-16-16H16c-8.837 0-16 7.163-16 16v40c0 8.837 7.163 16 16 16z"/></svg></button>
      
      <button 
        class="
          copy-code-button
          tw-select-none
          tw-mx-2 
          tw-hidden
          group-[.is-open]:tw-block
          hover:tw-text-fgColor-link 
          print:!tw-hidden"
        title="Copy code">
          <span class="copy-icon tw-block"><svg class="icon"
    xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><!-- Font Awesome Free 5.15.4 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) --><path d="M433.941 65.941l-51.882-51.882A48 48 0 0 0 348.118 0H176c-26.51 0-48 21.49-48 48v48H48c-26.51 0-48 21.49-48 48v320c0 26.51 21.49 48 48 48h224c26.51 0 48-21.49 48-48v-48h80c26.51 0 48-21.49 48-48V99.882a48 48 0 0 0-14.059-33.941zM266 464H54a6 6 0 0 1-6-6V150a6 6 0 0 1 6-6h74v224c0 26.51 21.49 48 48 48h96v42a6 6 0 0 1-6 6zm128-96H182a6 6 0 0 1-6-6V54a6 6 0 0 1 6-6h106v88c0 13.255 10.745 24 24 24h88v202a6 6 0 0 1-6 6zm6-256h-64V48h9.632c1.591 0 3.117.632 4.243 1.757l48.368 48.368a6 6 0 0 1 1.757 4.243V112z"/></svg></span>
          <span class="check-icon tw-hidden"><svg class="icon"
    xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><!-- Font Awesome Free 5.15.4 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) --><path d="M173.898 439.404l-166.4-166.4c-9.997-9.997-9.997-26.206 0-36.204l36.203-36.204c9.997-9.998 26.207-9.998 36.204 0L192 312.69 432.095 72.596c9.997-9.997 26.207-9.997 36.204 0l36.203 36.204c9.997 9.997 9.997 26.206 0 36.204l-294.4 294.401c-9.998 9.997-26.207 9.997-36.204-.001z"/></svg></span>
      </button>
        
      <button 
        class="
          tw-select-none 
          tw-mx-2 
          tw-block 
          group-[.is-open]:tw-hidden 
          print:!tw-hidden" 
        disabled
        aria-hidden="true"><svg class="icon"
    xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><!-- Font Awesome Free 5.15.4 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) --><path d="M328 256c0 39.8-32.2 72-72 72s-72-32.2-72-72 32.2-72 72-72 72 32.2 72 72zm104-72c-39.8 0-72 32.2-72 72s32.2 72 72 72 72-32.2 72-72-32.2-72-72-72zm-352 0c-39.8 0-72 32.2-72 72s32.2 72 72 72 72-32.2 72-72-32.2-72-72-72z"/></svg></button>
    </div>
  </div>
  <pre style="counter-reset: codeblock;" class="tw-block tw-m-0 tw-p-0"><code 
    id="codeblock-id-8" 
    class="
      chroma 
      !tw-block 
      tw-p-0
      tw-m-0
      tw-transition-[max-height] 
      tw-duration-500 
      tw-ease-in-out 
      group-[.is-closed]:!tw-max-h-0 
      group-[.is-wrap]:tw-text-wrap
      tw-overflow-y-hidden
      tw-overflow-x-auto
      tw-scrollbar-thin
      "><span class="line"><span class="cl">pip3 install torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/cpu</span></span></code></pre>
</div>
<p>进入 Python 上下文环境，执行以下命令，如果能输出正确的版本号，则 PyTorch 安装成功：</p>
<div class="code-block highlight is-open show-line-numbers  tw-group tw-my-2">
  <div class="
    code-block-title 
    
    tw-flex 
    tw-flex-row 
    tw-justify-between 
    tw-w-full tw-bg-bgColor-secondary
    ">      
    <button 
      class="
        tw-select-none 
        tw-mx-2 
        tw-block
        group-[.is-open]:tw-rotate-90
        tw-transition-[transform] 
        tw-duration-500 
        tw-ease-in-out
        print:!tw-hidden"
      disabled
      aria-hidden="true"><svg class="icon"
    xmlns="http://www.w3.org/2000/svg" viewBox="0 0 320 512"><!-- Font Awesome Free 5.15.4 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) --><path d="M285.476 272.971L91.132 467.314c-9.373 9.373-24.569 9.373-33.941 0l-22.667-22.667c-9.357-9.357-9.375-24.522-.04-33.901L188.505 256 34.484 101.255c-9.335-9.379-9.317-24.544.04-33.901l22.667-22.667c9.373-9.373 24.569-9.373 33.941 0L285.475 239.03c9.373 9.372 9.373 24.568.001 33.941z"/></svg></button>

    <div class="code-block-title-bar tw-w-full">
      <p class="tw-select-none !tw-my-1">python</p>
    </div>
    <div class="tw-flex">
      <button 
        class="
          line-number-button
          tw-select-none 
          tw-mx-2 
          tw-hidden 
          group-[.is-open]:tw-block 
          group-[.show-line-numbers]:tw-text-fgColor-link 
          print:!tw-hidden" 
        title="Toggle line numbers"><svg class="icon"
    xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><!-- Font Awesome Free 5.15.4 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) --><path d="M61.77 401l17.5-20.15a19.92 19.92 0 0 0 5.07-14.19v-3.31C84.34 356 80.5 352 73 352H16a8 8 0 0 0-8 8v16a8 8 0 0 0 8 8h22.83a157.41 157.41 0 0 0-11 12.31l-5.61 7c-4 5.07-5.25 10.13-2.8 14.88l1.05 1.93c3 5.76 6.29 7.88 12.25 7.88h4.73c10.33 0 15.94 2.44 15.94 9.09 0 4.72-4.2 8.22-14.36 8.22a41.54 41.54 0 0 1-15.47-3.12c-6.49-3.88-11.74-3.5-15.6 3.12l-5.59 9.31c-3.72 6.13-3.19 11.72 2.63 15.94 7.71 4.69 20.38 9.44 37 9.44 34.16 0 48.5-22.75 48.5-44.12-.03-14.38-9.12-29.76-28.73-34.88zM496 224H176a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16h320a16 16 0 0 0 16-16v-32a16 16 0 0 0-16-16zm0-160H176a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16h320a16 16 0 0 0 16-16V80a16 16 0 0 0-16-16zm0 320H176a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16h320a16 16 0 0 0 16-16v-32a16 16 0 0 0-16-16zM16 160h64a8 8 0 0 0 8-8v-16a8 8 0 0 0-8-8H64V40a8 8 0 0 0-8-8H32a8 8 0 0 0-7.14 4.42l-8 16A8 8 0 0 0 24 64h8v64H16a8 8 0 0 0-8 8v16a8 8 0 0 0 8 8zm-3.91 160H80a8 8 0 0 0 8-8v-16a8 8 0 0 0-8-8H41.32c3.29-10.29 48.34-18.68 48.34-56.44 0-29.06-25-39.56-44.47-39.56-21.36 0-33.8 10-40.46 18.75-4.37 5.59-3 10.84 2.8 15.37l8.58 6.88c5.61 4.56 11 2.47 16.12-2.44a13.44 13.44 0 0 1 9.46-3.84c3.33 0 9.28 1.56 9.28 8.75C51 248.19 0 257.31 0 304.59v4C0 316 5.08 320 12.09 320z"/></svg></button>

      <button 
        class="
          wrap-code-button
          tw-select-none 
          tw-mx-2 
          tw-hidden 
          group-[.is-open]:tw-block 
          group-[.is-wrap]:tw-text-fgColor-link 
          print:!tw-hidden" 
        title="Toggle code wrap"><svg class="icon"
    xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><!-- Font Awesome Free 5.15.4 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) --><path d="M16 132h416c8.837 0 16-7.163 16-16V76c0-8.837-7.163-16-16-16H16C7.163 60 0 67.163 0 76v40c0 8.837 7.163 16 16 16zm0 160h416c8.837 0 16-7.163 16-16v-40c0-8.837-7.163-16-16-16H16c-8.837 0-16 7.163-16 16v40c0 8.837 7.163 16 16 16zm0 160h416c8.837 0 16-7.163 16-16v-40c0-8.837-7.163-16-16-16H16c-8.837 0-16 7.163-16 16v40c0 8.837 7.163 16 16 16z"/></svg></button>
      
      <button 
        class="
          copy-code-button
          tw-select-none
          tw-mx-2 
          tw-hidden
          group-[.is-open]:tw-block
          hover:tw-text-fgColor-link 
          print:!tw-hidden"
        title="Copy code">
          <span class="copy-icon tw-block"><svg class="icon"
    xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><!-- Font Awesome Free 5.15.4 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) --><path d="M433.941 65.941l-51.882-51.882A48 48 0 0 0 348.118 0H176c-26.51 0-48 21.49-48 48v48H48c-26.51 0-48 21.49-48 48v320c0 26.51 21.49 48 48 48h224c26.51 0 48-21.49 48-48v-48h80c26.51 0 48-21.49 48-48V99.882a48 48 0 0 0-14.059-33.941zM266 464H54a6 6 0 0 1-6-6V150a6 6 0 0 1 6-6h74v224c0 26.51 21.49 48 48 48h96v42a6 6 0 0 1-6 6zm128-96H182a6 6 0 0 1-6-6V54a6 6 0 0 1 6-6h106v88c0 13.255 10.745 24 24 24h88v202a6 6 0 0 1-6 6zm6-256h-64V48h9.632c1.591 0 3.117.632 4.243 1.757l48.368 48.368a6 6 0 0 1 1.757 4.243V112z"/></svg></span>
          <span class="check-icon tw-hidden"><svg class="icon"
    xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><!-- Font Awesome Free 5.15.4 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) --><path d="M173.898 439.404l-166.4-166.4c-9.997-9.997-9.997-26.206 0-36.204l36.203-36.204c9.997-9.998 26.207-9.998 36.204 0L192 312.69 432.095 72.596c9.997-9.997 26.207-9.997 36.204 0l36.203 36.204c9.997 9.997 9.997 26.206 0 36.204l-294.4 294.401c-9.998 9.997-26.207 9.997-36.204-.001z"/></svg></span>
      </button>
        
      <button 
        class="
          tw-select-none 
          tw-mx-2 
          tw-block 
          group-[.is-open]:tw-hidden 
          print:!tw-hidden" 
        disabled
        aria-hidden="true"><svg class="icon"
    xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><!-- Font Awesome Free 5.15.4 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) --><path d="M328 256c0 39.8-32.2 72-72 72s-72-32.2-72-72 32.2-72 72-72 72 32.2 72 72zm104-72c-39.8 0-72 32.2-72 72s32.2 72 72 72 72-32.2 72-72-32.2-72-72-72zm-352 0c-39.8 0-72 32.2-72 72s32.2 72 72 72 72-32.2 72-72-32.2-72-72-72z"/></svg></button>
    </div>
  </div>
  <pre style="counter-reset: codeblock;" class="tw-block tw-m-0 tw-p-0"><code 
    id="codeblock-id-9" 
    class="
      chroma 
      !tw-block 
      tw-p-0
      tw-m-0
      tw-transition-[max-height] 
      tw-duration-500 
      tw-ease-in-out 
      group-[.is-closed]:!tw-max-h-0 
      group-[.is-wrap]:tw-text-wrap
      tw-overflow-y-hidden
      tw-overflow-x-auto
      tw-scrollbar-thin
      "><span class="line"><span class="cl"><span class="kn">import</span> <span class="nn">torch</span>
</span></span><span class="line"><span class="cl"><span class="n">torch</span><span class="o">.</span><span class="n">__version__</span></span></span></code></pre>
</div>
<div align="center" ><img src="https://img1.wlcheng.cc/images_for_blogs/20230301180410.png" alt="20230301180410" width="75%" style="box-shadow: 0 3px 6px rgba(0,0,0,0.16), 0 3px 6px rgba(0,0,0,0.23);border-radius:10px;"/></div>
<p><strong>参考：</strong></p>
<p>[4] PyTorch 安装命令. <a href="https://pytorch.org/get-started/locally/" target="_blank" rel="noopener noreferrer">https://pytorch.org/get-started/locally/</a></p>
<p>[5] Hitesh Jethva, LCTT. Linux 系统下查看硬件信息命令大全. <a href="https://linux.cn/article-6928-1.html" target="_blank" rel="noopener noreferrer">https://linux.cn/article-6928-1.html</a>, 命令 <code>inxi -Fx</code> 好使</p>
<h2 id="常用-conda-命令" class="headerLink">
    <a href="#%e5%b8%b8%e7%94%a8-conda-%e5%91%bd%e4%bb%a4" class="header-mark"></a>常用 Conda 命令</h2><h3 id="环境管理命令" class="headerLink">
    <a href="#%e7%8e%af%e5%a2%83%e7%ae%a1%e7%90%86%e5%91%bd%e4%bb%a4" class="header-mark"></a>环境管理命令</h3><div class="code-block highlight is-closed show-line-numbers  tw-group tw-my-2">
  <div class="
    code-block-title 
    
    tw-flex 
    tw-flex-row 
    tw-justify-between 
    tw-w-full tw-bg-bgColor-secondary
    ">      
    <button 
      class="
        tw-select-none 
        tw-mx-2 
        tw-block
        group-[.is-open]:tw-rotate-90
        tw-transition-[transform] 
        tw-duration-500 
        tw-ease-in-out
        print:!tw-hidden"
      disabled
      aria-hidden="true"><svg class="icon"
    xmlns="http://www.w3.org/2000/svg" viewBox="0 0 320 512"><!-- Font Awesome Free 5.15.4 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) --><path d="M285.476 272.971L91.132 467.314c-9.373 9.373-24.569 9.373-33.941 0l-22.667-22.667c-9.357-9.357-9.375-24.522-.04-33.901L188.505 256 34.484 101.255c-9.335-9.379-9.317-24.544.04-33.901l22.667-22.667c9.373-9.373 24.569-9.373 33.941 0L285.475 239.03c9.373 9.372 9.373 24.568.001 33.941z"/></svg></button>

    <div class="code-block-title-bar tw-w-full">
      <p class="tw-select-none !tw-my-1">bash</p>
    </div>
    <div class="tw-flex">
      <button 
        class="
          line-number-button
          tw-select-none 
          tw-mx-2 
          tw-hidden 
          group-[.is-open]:tw-block 
          group-[.show-line-numbers]:tw-text-fgColor-link 
          print:!tw-hidden" 
        title="Toggle line numbers"><svg class="icon"
    xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><!-- Font Awesome Free 5.15.4 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) --><path d="M61.77 401l17.5-20.15a19.92 19.92 0 0 0 5.07-14.19v-3.31C84.34 356 80.5 352 73 352H16a8 8 0 0 0-8 8v16a8 8 0 0 0 8 8h22.83a157.41 157.41 0 0 0-11 12.31l-5.61 7c-4 5.07-5.25 10.13-2.8 14.88l1.05 1.93c3 5.76 6.29 7.88 12.25 7.88h4.73c10.33 0 15.94 2.44 15.94 9.09 0 4.72-4.2 8.22-14.36 8.22a41.54 41.54 0 0 1-15.47-3.12c-6.49-3.88-11.74-3.5-15.6 3.12l-5.59 9.31c-3.72 6.13-3.19 11.72 2.63 15.94 7.71 4.69 20.38 9.44 37 9.44 34.16 0 48.5-22.75 48.5-44.12-.03-14.38-9.12-29.76-28.73-34.88zM496 224H176a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16h320a16 16 0 0 0 16-16v-32a16 16 0 0 0-16-16zm0-160H176a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16h320a16 16 0 0 0 16-16V80a16 16 0 0 0-16-16zm0 320H176a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16h320a16 16 0 0 0 16-16v-32a16 16 0 0 0-16-16zM16 160h64a8 8 0 0 0 8-8v-16a8 8 0 0 0-8-8H64V40a8 8 0 0 0-8-8H32a8 8 0 0 0-7.14 4.42l-8 16A8 8 0 0 0 24 64h8v64H16a8 8 0 0 0-8 8v16a8 8 0 0 0 8 8zm-3.91 160H80a8 8 0 0 0 8-8v-16a8 8 0 0 0-8-8H41.32c3.29-10.29 48.34-18.68 48.34-56.44 0-29.06-25-39.56-44.47-39.56-21.36 0-33.8 10-40.46 18.75-4.37 5.59-3 10.84 2.8 15.37l8.58 6.88c5.61 4.56 11 2.47 16.12-2.44a13.44 13.44 0 0 1 9.46-3.84c3.33 0 9.28 1.56 9.28 8.75C51 248.19 0 257.31 0 304.59v4C0 316 5.08 320 12.09 320z"/></svg></button>

      <button 
        class="
          wrap-code-button
          tw-select-none 
          tw-mx-2 
          tw-hidden 
          group-[.is-open]:tw-block 
          group-[.is-wrap]:tw-text-fgColor-link 
          print:!tw-hidden" 
        title="Toggle code wrap"><svg class="icon"
    xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><!-- Font Awesome Free 5.15.4 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) --><path d="M16 132h416c8.837 0 16-7.163 16-16V76c0-8.837-7.163-16-16-16H16C7.163 60 0 67.163 0 76v40c0 8.837 7.163 16 16 16zm0 160h416c8.837 0 16-7.163 16-16v-40c0-8.837-7.163-16-16-16H16c-8.837 0-16 7.163-16 16v40c0 8.837 7.163 16 16 16zm0 160h416c8.837 0 16-7.163 16-16v-40c0-8.837-7.163-16-16-16H16c-8.837 0-16 7.163-16 16v40c0 8.837 7.163 16 16 16z"/></svg></button>
      
      <button 
        class="
          copy-code-button
          tw-select-none
          tw-mx-2 
          tw-hidden
          group-[.is-open]:tw-block
          hover:tw-text-fgColor-link 
          print:!tw-hidden"
        title="Copy code">
          <span class="copy-icon tw-block"><svg class="icon"
    xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><!-- Font Awesome Free 5.15.4 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) --><path d="M433.941 65.941l-51.882-51.882A48 48 0 0 0 348.118 0H176c-26.51 0-48 21.49-48 48v48H48c-26.51 0-48 21.49-48 48v320c0 26.51 21.49 48 48 48h224c26.51 0 48-21.49 48-48v-48h80c26.51 0 48-21.49 48-48V99.882a48 48 0 0 0-14.059-33.941zM266 464H54a6 6 0 0 1-6-6V150a6 6 0 0 1 6-6h74v224c0 26.51 21.49 48 48 48h96v42a6 6 0 0 1-6 6zm128-96H182a6 6 0 0 1-6-6V54a6 6 0 0 1 6-6h106v88c0 13.255 10.745 24 24 24h88v202a6 6 0 0 1-6 6zm6-256h-64V48h9.632c1.591 0 3.117.632 4.243 1.757l48.368 48.368a6 6 0 0 1 1.757 4.243V112z"/></svg></span>
          <span class="check-icon tw-hidden"><svg class="icon"
    xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><!-- Font Awesome Free 5.15.4 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) --><path d="M173.898 439.404l-166.4-166.4c-9.997-9.997-9.997-26.206 0-36.204l36.203-36.204c9.997-9.998 26.207-9.998 36.204 0L192 312.69 432.095 72.596c9.997-9.997 26.207-9.997 36.204 0l36.203 36.204c9.997 9.997 9.997 26.206 0 36.204l-294.4 294.401c-9.998 9.997-26.207 9.997-36.204-.001z"/></svg></span>
      </button>
        
      <button 
        class="
          tw-select-none 
          tw-mx-2 
          tw-block 
          group-[.is-open]:tw-hidden 
          print:!tw-hidden" 
        disabled
        aria-hidden="true"><svg class="icon"
    xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><!-- Font Awesome Free 5.15.4 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) --><path d="M328 256c0 39.8-32.2 72-72 72s-72-32.2-72-72 32.2-72 72-72 72 32.2 72 72zm104-72c-39.8 0-72 32.2-72 72s32.2 72 72 72 72-32.2 72-72-32.2-72-72-72zm-352 0c-39.8 0-72 32.2-72 72s32.2 72 72 72 72-32.2 72-72-32.2-72-72-72z"/></svg></button>
    </div>
  </div>
  <pre style="counter-reset: codeblock;" class="tw-block tw-m-0 tw-p-0"><code 
    id="codeblock-id-10" 
    class="
      chroma 
      !tw-block 
      tw-p-0
      tw-m-0
      tw-transition-[max-height] 
      tw-duration-500 
      tw-ease-in-out 
      group-[.is-closed]:!tw-max-h-0 
      group-[.is-wrap]:tw-text-wrap
      tw-overflow-y-hidden
      tw-overflow-x-auto
      tw-scrollbar-thin
      "><span class="line"><span class="cl"><span class="c1"># 创建虚拟环境</span>
</span></span><span class="line"><span class="cl">conda create --name 环境名 <span class="nv">python</span><span class="o">=</span>3.7 <span class="o">[</span>可以指定其他需要安装的包<span class="o">]</span>
</span></span><span class="line"><span class="cl"><span class="c1"># 删除某个环境</span>
</span></span><span class="line"><span class="cl">conda remove --name 环境名 --all
</span></span><span class="line"><span class="cl"><span class="c1"># 列出所有环境</span>
</span></span><span class="line"><span class="cl">conda env list
</span></span><span class="line"><span class="cl">或者
</span></span><span class="line"><span class="cl">conda info --envs
</span></span><span class="line"><span class="cl"><span class="c1"># 进入某个环境</span>
</span></span><span class="line"><span class="cl">conda activate 环境名
</span></span><span class="line"><span class="cl"><span class="c1"># 退出当前环境</span>
</span></span><span class="line"><span class="cl">conda deactivate
</span></span><span class="line"><span class="cl"><span class="c1"># 列出当前环境下安装的包</span>
</span></span><span class="line"><span class="cl">conda list
</span></span><span class="line"><span class="cl"><span class="c1"># 导出环境配置</span>
</span></span><span class="line"><span class="cl">conda env <span class="nb">export</span> &gt; environment.txt
</span></span><span class="line"><span class="cl"><span class="c1"># 从配置文件创建新环境</span>
</span></span><span class="line"><span class="cl">conda ceate --name 环境名 --file environment.txt
</span></span><span class="line"><span class="cl"><span class="c1"># 重命名环境（克隆旧环境，删除旧环境）</span>
</span></span><span class="line"><span class="cl">conda create --name 新环境名 --clone 旧环境名
</span></span><span class="line"><span class="cl">conda env remove --name 旧环境名</span></span></code></pre>
</div>
<h3 id="源频道管理命令" class="headerLink">
    <a href="#%e6%ba%90%e9%a2%91%e9%81%93%e7%ae%a1%e7%90%86%e5%91%bd%e4%bb%a4" class="header-mark"></a>源（频道）管理命令</h3><div class="code-block highlight is-open show-line-numbers  tw-group tw-my-2">
  <div class="
    code-block-title 
    
    tw-flex 
    tw-flex-row 
    tw-justify-between 
    tw-w-full tw-bg-bgColor-secondary
    ">      
    <button 
      class="
        tw-select-none 
        tw-mx-2 
        tw-block
        group-[.is-open]:tw-rotate-90
        tw-transition-[transform] 
        tw-duration-500 
        tw-ease-in-out
        print:!tw-hidden"
      disabled
      aria-hidden="true"><svg class="icon"
    xmlns="http://www.w3.org/2000/svg" viewBox="0 0 320 512"><!-- Font Awesome Free 5.15.4 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) --><path d="M285.476 272.971L91.132 467.314c-9.373 9.373-24.569 9.373-33.941 0l-22.667-22.667c-9.357-9.357-9.375-24.522-.04-33.901L188.505 256 34.484 101.255c-9.335-9.379-9.317-24.544.04-33.901l22.667-22.667c9.373-9.373 24.569-9.373 33.941 0L285.475 239.03c9.373 9.372 9.373 24.568.001 33.941z"/></svg></button>

    <div class="code-block-title-bar tw-w-full">
      <p class="tw-select-none !tw-my-1">bash</p>
    </div>
    <div class="tw-flex">
      <button 
        class="
          line-number-button
          tw-select-none 
          tw-mx-2 
          tw-hidden 
          group-[.is-open]:tw-block 
          group-[.show-line-numbers]:tw-text-fgColor-link 
          print:!tw-hidden" 
        title="Toggle line numbers"><svg class="icon"
    xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><!-- Font Awesome Free 5.15.4 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) --><path d="M61.77 401l17.5-20.15a19.92 19.92 0 0 0 5.07-14.19v-3.31C84.34 356 80.5 352 73 352H16a8 8 0 0 0-8 8v16a8 8 0 0 0 8 8h22.83a157.41 157.41 0 0 0-11 12.31l-5.61 7c-4 5.07-5.25 10.13-2.8 14.88l1.05 1.93c3 5.76 6.29 7.88 12.25 7.88h4.73c10.33 0 15.94 2.44 15.94 9.09 0 4.72-4.2 8.22-14.36 8.22a41.54 41.54 0 0 1-15.47-3.12c-6.49-3.88-11.74-3.5-15.6 3.12l-5.59 9.31c-3.72 6.13-3.19 11.72 2.63 15.94 7.71 4.69 20.38 9.44 37 9.44 34.16 0 48.5-22.75 48.5-44.12-.03-14.38-9.12-29.76-28.73-34.88zM496 224H176a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16h320a16 16 0 0 0 16-16v-32a16 16 0 0 0-16-16zm0-160H176a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16h320a16 16 0 0 0 16-16V80a16 16 0 0 0-16-16zm0 320H176a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16h320a16 16 0 0 0 16-16v-32a16 16 0 0 0-16-16zM16 160h64a8 8 0 0 0 8-8v-16a8 8 0 0 0-8-8H64V40a8 8 0 0 0-8-8H32a8 8 0 0 0-7.14 4.42l-8 16A8 8 0 0 0 24 64h8v64H16a8 8 0 0 0-8 8v16a8 8 0 0 0 8 8zm-3.91 160H80a8 8 0 0 0 8-8v-16a8 8 0 0 0-8-8H41.32c3.29-10.29 48.34-18.68 48.34-56.44 0-29.06-25-39.56-44.47-39.56-21.36 0-33.8 10-40.46 18.75-4.37 5.59-3 10.84 2.8 15.37l8.58 6.88c5.61 4.56 11 2.47 16.12-2.44a13.44 13.44 0 0 1 9.46-3.84c3.33 0 9.28 1.56 9.28 8.75C51 248.19 0 257.31 0 304.59v4C0 316 5.08 320 12.09 320z"/></svg></button>

      <button 
        class="
          wrap-code-button
          tw-select-none 
          tw-mx-2 
          tw-hidden 
          group-[.is-open]:tw-block 
          group-[.is-wrap]:tw-text-fgColor-link 
          print:!tw-hidden" 
        title="Toggle code wrap"><svg class="icon"
    xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><!-- Font Awesome Free 5.15.4 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) --><path d="M16 132h416c8.837 0 16-7.163 16-16V76c0-8.837-7.163-16-16-16H16C7.163 60 0 67.163 0 76v40c0 8.837 7.163 16 16 16zm0 160h416c8.837 0 16-7.163 16-16v-40c0-8.837-7.163-16-16-16H16c-8.837 0-16 7.163-16 16v40c0 8.837 7.163 16 16 16zm0 160h416c8.837 0 16-7.163 16-16v-40c0-8.837-7.163-16-16-16H16c-8.837 0-16 7.163-16 16v40c0 8.837 7.163 16 16 16z"/></svg></button>
      
      <button 
        class="
          copy-code-button
          tw-select-none
          tw-mx-2 
          tw-hidden
          group-[.is-open]:tw-block
          hover:tw-text-fgColor-link 
          print:!tw-hidden"
        title="Copy code">
          <span class="copy-icon tw-block"><svg class="icon"
    xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><!-- Font Awesome Free 5.15.4 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) --><path d="M433.941 65.941l-51.882-51.882A48 48 0 0 0 348.118 0H176c-26.51 0-48 21.49-48 48v48H48c-26.51 0-48 21.49-48 48v320c0 26.51 21.49 48 48 48h224c26.51 0 48-21.49 48-48v-48h80c26.51 0 48-21.49 48-48V99.882a48 48 0 0 0-14.059-33.941zM266 464H54a6 6 0 0 1-6-6V150a6 6 0 0 1 6-6h74v224c0 26.51 21.49 48 48 48h96v42a6 6 0 0 1-6 6zm128-96H182a6 6 0 0 1-6-6V54a6 6 0 0 1 6-6h106v88c0 13.255 10.745 24 24 24h88v202a6 6 0 0 1-6 6zm6-256h-64V48h9.632c1.591 0 3.117.632 4.243 1.757l48.368 48.368a6 6 0 0 1 1.757 4.243V112z"/></svg></span>
          <span class="check-icon tw-hidden"><svg class="icon"
    xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><!-- Font Awesome Free 5.15.4 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) --><path d="M173.898 439.404l-166.4-166.4c-9.997-9.997-9.997-26.206 0-36.204l36.203-36.204c9.997-9.998 26.207-9.998 36.204 0L192 312.69 432.095 72.596c9.997-9.997 26.207-9.997 36.204 0l36.203 36.204c9.997 9.997 9.997 26.206 0 36.204l-294.4 294.401c-9.998 9.997-26.207 9.997-36.204-.001z"/></svg></span>
      </button>
        
      <button 
        class="
          tw-select-none 
          tw-mx-2 
          tw-block 
          group-[.is-open]:tw-hidden 
          print:!tw-hidden" 
        disabled
        aria-hidden="true"><svg class="icon"
    xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><!-- Font Awesome Free 5.15.4 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) --><path d="M328 256c0 39.8-32.2 72-72 72s-72-32.2-72-72 32.2-72 72-72 72 32.2 72 72zm104-72c-39.8 0-72 32.2-72 72s32.2 72 72 72 72-32.2 72-72-32.2-72-72-72zm-352 0c-39.8 0-72 32.2-72 72s32.2 72 72 72 72-32.2 72-72-32.2-72-72-72z"/></svg></button>
    </div>
  </div>
  <pre style="counter-reset: codeblock;" class="tw-block tw-m-0 tw-p-0"><code 
    id="codeblock-id-11" 
    class="
      chroma 
      !tw-block 
      tw-p-0
      tw-m-0
      tw-transition-[max-height] 
      tw-duration-500 
      tw-ease-in-out 
      group-[.is-closed]:!tw-max-h-0 
      group-[.is-wrap]:tw-text-wrap
      tw-overflow-y-hidden
      tw-overflow-x-auto
      tw-scrollbar-thin
      "><span class="line"><span class="cl"><span class="c1">## 添加新的源</span>
</span></span><span class="line"><span class="cl"><span class="c1"># 新加源具有高优先级</span>
</span></span><span class="line"><span class="cl">conda config --add channels source_url
</span></span><span class="line"><span class="cl">conda config --prepend channels source_url <span class="c1">#同上等效</span>
</span></span><span class="line"><span class="cl"><span class="c1"># 新加源具有低优先级</span>
</span></span><span class="line"><span class="cl">conda config --append channels source_url
</span></span><span class="line"><span class="cl"><span class="c1">## 查看已有的源</span>
</span></span><span class="line"><span class="cl">conda config --get channels</span></span></code></pre>
</div>
<p><strong>参考：</strong></p>
<p>[6] 朱渠成. miniconda的常用命令汇总. <a href="https://www.jianshu.com/p/0e9c88479cfd" target="_blank" rel="noopener noreferrer">https://www.jianshu.com/p/0e9c88479cfd</a></p>
<p>[7] Fission0102. miniconda 常用命令. <a href="https://www.cnblogs.com/Fission0102/p/13998824.html" target="_blank" rel="noopener noreferrer">https://www.cnblogs.com/Fission0102/p/13998824.html</a></p>]]></description></item><item><title>Github 图床 PicGo 使用</title><link>https://wlcheng.cc/posts/github_picture_bed/</link><pubDate>Fri, 06 May 2022 18:42:12 +0800</pubDate><author><name>wlcheng</name></author><guid>https://wlcheng.cc/posts/github_picture_bed/</guid><description><![CDATA[<p>用 Github 仓库作为自用图床；用 PicGo 直接在 Typora 和 VS Code 中一键上传图床、粘贴图链。</p>
<h2 id="搭建github图床" class="headerLink">
    <a href="#%e6%90%ad%e5%bb%bagithub%e5%9b%be%e5%ba%8a" class="header-mark"></a>搭建Github图床</h2><p>Github仓库支持<code>1G</code>存储容量。</p>
<h3 id="创建github仓库" class="headerLink">
    <a href="#%e5%88%9b%e5%bb%bagithub%e4%bb%93%e5%ba%93" class="header-mark"></a>创建Github仓库</h3><p>在Github主页点击<code>New Repository</code>开始创建仓库。</p>
<div align="center" ><img src="https://img1.wlcheng.cc/images_for_blogs/20220506185400.png" alt="20220506185400" width="90%" style="box-shadow: 0 3px 6px rgba(0,0,0,0.16), 0 3px 6px rgba(0,0,0,0.23);border-radius:10px;"/></div>
<p>基本设置：<code>仓库名</code>，<code>描述</code>，仓库类型<code>public</code>，勾选<code>Add a README file</code>，其他保持默认即可。然后点击<code>Create repo</code>。</p>
<div align="center" ><img src="https://img1.wlcheng.cc/images_for_blogs/20220506190127.png" alt="20220506190127" width="90%" style="box-shadow: 0 3px 6px rgba(0,0,0,0.16), 0 3px 6px rgba(0,0,0,0.23);border-radius:10px;"/></div>
<p>然后网页会自动跳转到我们刚刚创建的仓库主页。我们要在这个仓库下面创建一个文件夹用于以后存放图片（当然不创建文件夹，直接将图片上传到仓库个目录也可以）。点击<code>Add file</code>下的<code>Create new file</code>。</p>
<div align="center" ><img src="https://img1.wlcheng.cc/images_for_blogs/20220506192016.png" alt="20220506192016" width="90%" style="box-shadow: 0 3px 6px rgba(0,0,0,0.16), 0 3px 6px rgba(0,0,0,0.23);border-radius:10px;"/></div>
<p>跳转到以下页面，我们按照图中方式依次输入<code>foldername</code>，<code>/</code>，<code>filename</code>，名字自己任取就行。因为这里不支持只创建文件夹，因此需要给出一个文件名。点击<code>Commit new file</code>提交更改。</p>
<div align="center" ><img src="https://img1.wlcheng.cc/images_for_blogs/20220506192200.png" alt="20220506192200" width="90%" style="box-shadow: 0 3px 6px rgba(0,0,0,0.16), 0 3px 6px rgba(0,0,0,0.23);border-radius:10px;"/></div>
<h3 id="创建repo-token" class="headerLink">
    <a href="#%e5%88%9b%e5%bb%barepo-token" class="header-mark"></a>创建repo token</h3><p>token 用于给后面我们用 PicGo 访问仓库并上传图片赋予权限。</p>
<p>首先在自己的头像下点击<code>Settings</code>。</p>
<div align="center" ><img src="https://img1.wlcheng.cc/images_for_blogs/20220506193458.png" alt="20220506193458" width="90%" style="box-shadow: 0 3px 6px rgba(0,0,0,0.16), 0 3px 6px rgba(0,0,0,0.23);border-radius:10px;"/></div>
<p>在左侧边栏往下找到并打开<code>Developer settings</code></p>
<div align="center" ><img src="https://img1.wlcheng.cc/images_for_blogs/20220506194000.png" alt="20220506194000" width="90%" style="box-shadow: 0 3px 6px rgba(0,0,0,0.16), 0 3px 6px rgba(0,0,0,0.23);border-radius:10px;"/></div>
<p>如下图，点击左侧边栏<code>Personal access token</code>，然后点击<code>Generate new token</code></p>
<div align="center" ><img src="https://img2.wlcheng.cc/images/image-20220506232019743.png" alt="image-20220506232019743" width="90%" style="box-shadow: 0 3px 6px rgba(0,0,0,0.16), 0 3px 6px rgba(0,0,0,0.23);border-radius:10px;"/></div>
<p>此步因为要赋予权限，因此会弹出窗口验证账号密码，填入后<code>Confirm password</code>即可。
然后就会到以下的 token 设置界面，按照图中所述进行创建即可。</p>
<div align="center" ><img src="https://img1.wlcheng.cc/images_for_blogs/20220506195204.png" alt="20220506195204" width="90%" style="box-shadow: 0 3px 6px rgba(0,0,0,0.16), 0 3px 6px rgba(0,0,0,0.23);border-radius:10px;"/></div>
<p>成功生成token后，马上复制下来，之后配置PicGo会用到。</p>
<div align="center" ><img src="https://img2.wlcheng.cc/images/image-20220506232149655.png" alt="image-20220506232149655" width="90%" style="box-shadow: 0 3px 6px rgba(0,0,0,0.16), 0 3px 6px rgba(0,0,0,0.23);border-radius:10px;"/></div>
<p>通过以上过程，我们的图床算是搭建完毕了，接下来就要利用 PicGo 实现从本地上传图片，并获取图片链接。</p>
<h2 id="配置picgo" class="headerLink">
    <a href="#%e9%85%8d%e7%bd%aepicgo" class="header-mark"></a>配置PicGo</h2><p>官方网站：<a href="https://molunerfinn.com/PicGo/" target="_blank" rel="noopener noreferrer">PicGo</a>。此处下载稳定版本的 <a href="https://mirror.ghproxy.com/https://github.com/Molunerfinn/PicGo/releases/download/v2.3.0/PicGo-Setup-2.3.0-x64.exe" target="_blank" rel="noopener noreferrer">PicGo</a>。下载后，按下图安装即可</p>
<div align="center" ><img src="https://img1.wlcheng.cc/images_for_blogs/20220506200746.png" alt="20220506200746" width="90%" style="box-shadow: 0 3px 6px rgba(0,0,0,0.16), 0 3px 6px rgba(0,0,0,0.23);border-radius:10px;"/></div>
<p>启动后，直接左键单击托盘图标，打开PicGo设置界面</p>
<div align="center" ><img src="https://img1.wlcheng.cc/images_for_blogs/20220506200941.png" alt="20220506200941" width="120" style="box-shadow: 0 3px 6px rgba(0,0,0,0.16), 0 3px 6px rgba(0,0,0,0.23);border-radius:10px;"/></div>
<p>如下图，左侧展开<code>图床设置</code>，点击<code>Github图床</code>，右侧填入相关设置信息。</p>
<div align="center" ><img src="https://img1.wlcheng.cc/images_for_blogs/20220506201703.png" alt="20220506201703" width="75%" style="box-shadow: 0 3px 6px rgba(0,0,0,0.16), 0 3px 6px rgba(0,0,0,0.23);border-radius:10px;"/></div>
<p>以上填写各项的说明：</p>
<p>对于<code>仓库名</code>，<code>分支名</code>，<code>存储路径</code>这几项，我们已经通过前面的步骤创建了，打开如下的仓库主页面，就可以知道。</p>
<div align="center" ><img src="https://img1.wlcheng.cc/images_for_blogs/20220506202323.png" alt="20220506202323" width="90%" style="box-shadow: 0 3px 6px rgba(0,0,0,0.16), 0 3px 6px rgba(0,0,0,0.23);border-radius:10px;"/></div>
<p>而对于<code>token</code>，我们前面创建并已经复制了的，粘贴进来就可以。</p>
<p>对于自定义域名，</p>
<p>我们上传图片的Github官方链接是：
<code>https://raw.githubusercontent.com/用户名/仓库名@分支名</code>，可以直接通过此链接进行访问。但因为网速问题，我们往往通过 CDN 内容服务器进行访问，相当于是在全球各地建立内容缓存服务器，在访问内容时，能从就近的服务器上快速获取到内容。</p>
<p>使用 jsDilivr 作为 CDN 为 Github 提供加速。只需要按照以下格式填入上面的<code>自定义域名</code>框中就行：</p>
<p>❌<code>https://cdn.jsdelivr.net/gh/用户名/仓库名@分支名</code></p>
<p>但是，由于<code>cdn.jsdelivr.net</code>遭到 DNS 污染 (<a href="https://luotianyi.vc/6295.html" target="_blank" rel="noopener noreferrer">Luminous’ Home</a>)，暂将<code>自定义域名</code>更换为：</p>
<p>⭕<code>https://fastly.jsdelivr.net/gh/用户名/仓库名@分支名</code></p>
<p>或者其他备用：</p>
<blockquote>
  <p>CloudFlare：<code>test1.jsdelivr.net</code></p>
<p>CloudFlare：<code>testingcf.jsdelivr.net</code></p>
<p>Fastly：<code>fastly.jsdelivr.net</code></p>
<p>GCORE：<code>gcore.jsdelivr.net</code></p>
</blockquote><p><font color=#FF0000>那么对于我的设置，我这里应该填入的是：</font>
<code>https://fastly.jsdelivr.net/gh/wlchenGG/myPictureBed@main</code></p>
<p>填好以上信息后，点击确定即可设置成功。</p>
<p>我们可以测试一下，在上传区，改为 Github图床，然后上传一张图片，稍作等待，提示上传成功后，将自动复制创建好的链接（这个链接默认为markdown的，后续我们会自定义一下）。</p>
<div align="center" ><img src="https://img1.wlcheng.cc/images_for_blogs/20220506205131.png" alt="20220506205131" width="75%" style="box-shadow: 0 3px 6px rgba(0,0,0,0.16), 0 3px 6px rgba(0,0,0,0.23);border-radius:10px;"/></div>
<p>以下是我测试生成的默认markdown格式链接，你可以将其放入markdown文件中测试一下，是一张可正常访问的图片，说明能够正常上传。</p>
<p><code>![](https://fastly.jsdelivr.net/gh/wlchenGG/myPictureBed@main/images/wallpaper19.jpg)</code></p>
<h2 id="配置typora" class="headerLink">
    <a href="#%e9%85%8d%e7%bd%aetypora" class="header-mark"></a>配置Typora</h2><p>打开Typora，按照下图设置。其中第7步选择自己安装PicGo的位置。</p>
<div align="center" ><img src="https://img1.wlcheng.cc/images_for_blogs/20220506220821.png" alt="20220506220821" width="75%" style="box-shadow: 0 3px 6px rgba(0,0,0,0.16), 0 3px 6px rgba(0,0,0,0.23);border-radius:10px;"/><br><div style="color:orange; border-bottom: 1px solid #d9d9d9; display: inline-block; color: #777; font-size: 90%; padding: 1px;">此处插入标题</div></div>
<p>测试一下，在Typora编辑界面，粘贴或者拖入图片时，将自动以Markdown格式插入图片，从链接可以看出图像已经上传。</p>
<div align="center" ><img src="https://img1.wlcheng.cc/images_for_blogs/20220506224317.png" alt="20220506224317" width="75%" style="box-shadow: 0 3px 6px rgba(0,0,0,0.16), 0 3px 6px rgba(0,0,0,0.23);border-radius:10px;"/></div>
<p>我们手头已经有很多文档，图片都是本地保存的怎么办呢。只需要完成以上设置后，通过以下选项，就可以将当前文档中的所有本地图片上传到图床中，并会自动将文档中的图片链接全部替换为图床链接。</p>
<div align="center" ><img src="https://img2.wlcheng.cc/images/image-20220506230959338.png" alt="image-20220506230959338" width="75%" style="box-shadow: 0 3px 6px rgba(0,0,0,0.16), 0 3px 6px rgba(0,0,0,0.23);border-radius:10px;"/></div>
<h2 id="自定义链接格式控制图片样式可选" class="headerLink">
    <a href="#%e8%87%aa%e5%ae%9a%e4%b9%89%e9%93%be%e6%8e%a5%e6%a0%bc%e5%bc%8f%e6%8e%a7%e5%88%b6%e5%9b%be%e7%89%87%e6%a0%b7%e5%bc%8f%e5%8f%af%e9%80%89" class="header-mark"></a>自定义链接格式控制图片样式（可选）</h2><p>打开PicGo，按照以下步骤设置</p>
<div align="center" ><img src="https://img1.wlcheng.cc/images_for_blogs/20220506205704.png" alt="20220506205704" width="75%" style="box-shadow: 0 3px 6px rgba(0,0,0,0.16), 0 3px 6px rgba(0,0,0,0.23);border-radius:10px;"/></div>
<p>其中，自定义链接的格式（这是一段HTML代码，我们用来美化图片的显示样式。
我们给出如下几种，自行选择所需，将其粘贴到上图4的框中即可。</p>
<style>
table th:first-of-type {
    width: 16%;
}
table th:nth-of-type(2) {
    width: 16%;
}
table th:nth-of-type(3) {
    width: 68%;
}
</style>

<div class="table-wrapper">
  <table>
    <thead>
        <tr>
            <th style="text-align: center">美化方式</th>
            <th style="text-align: center">效果图</th>
            <th style="text-align: ">链接格式</th>
        </tr>
    </thead>
    <tbody>
        <tr>
            <td style="text-align: center">控制大小</td>
            <td style="text-align: center"><div align="center" ><img src="https://img2.wlcheng.cc/images/wallpaper19.jpg" alt="wallpaper19" width="120"/></div></td>
            <td style="text-align: "><code>&lt;div align=&quot;center&quot; &gt;&lt;img src=&quot;$url&quot; alt=&quot;$fileName&quot; width=&quot;75%&quot;/&gt;&lt;/div&gt;</code></td>
        </tr>
        <tr>
            <td style="text-align: center">圆角处理</td>
            <td style="text-align: center"><div align="center" ><img src="https://img2.wlcheng.cc/images/wallpaper19.jpg" alt="wallpaper19" width="120" style="border-radius:10px;"/></div></td>
            <td style="text-align: "><code>&lt;div align=&quot;center&quot; &gt;&lt;img src=&quot;$url&quot; alt=&quot;$fileName&quot; width=&quot;75%&quot; style=&quot;border-radius:10px;&quot;/&gt;&lt;/div&gt;</code></td>
        </tr>
        <tr>
            <td style="text-align: center">图片阴影</td>
            <td style="text-align: center"><div align="center" ><img src="https://img2.wlcheng.cc/images/wallpaper19.jpg" alt="wallpaper19" width="120" style="box-shadow: 0 3px 6px rgba(0,0,0,0.16), 0 3px 6px rgba(0,0,0,0.23);"/></div></td>
            <td style="text-align: "><code>&lt;div align=&quot;center&quot; &gt;&lt;img src=&quot;$url&quot; alt=&quot;$fileName&quot; width=&quot;75%&quot; style=&quot;box-shadow: 0 3px 6px rgba(0,0,0,0.16), 0 3px 6px rgba(0,0,0,0.23);&quot;/&gt;&lt;/div&gt;</code></td>
        </tr>
        <tr>
            <td style="text-align: center">阴影+圆角</td>
            <td style="text-align: center"><div align="center" ><img src="https://img2.wlcheng.cc/images/wallpaper19.jpg" alt="wallpaper19" width="120" style="box-shadow: 0 3px 6px rgba(0,0,0,0.16), 0 3px 6px rgba(0,0,0,0.23);border-radius:10px;"/></div></td>
            <td style="text-align: "><code>&lt;div align=&quot;center&quot; &gt;&lt;img src=&quot;$url&quot; alt=&quot;$fileName&quot; width=&quot;75%&quot; style=&quot;box-shadow: 0 3px 6px rgba(0,0,0,0.16), 0 3px 6px rgba(0,0,0,0.23);border-radius:10px;&quot;/&gt;&lt;/div&gt;</code></td>
        </tr>
        <tr>
            <td style="text-align: center">阴影+标题</td>
            <td style="text-align: center"><div align="center" ><img src="https://img2.wlcheng.cc/images/wallpaper19.jpg" alt="wallpaper19" width="120" style="box-shadow: 0 3px 6px rgba(0,0,0,0.16), 0 3px 6px rgba(0,0,0,0.23);"/><br><div style="color:orange; border-bottom: 1px solid #d9d9d9; display: inline-block; color: #777; font-size: 90%; padding: 1px;">此处插入标题</div></div></td>
            <td style="text-align: "><code>&lt;div align=&quot;center&quot; &gt;&lt;img src=&quot;$url&quot; alt=&quot;$fileName&quot; width=&quot;75%&quot; style=&quot;box-shadow: 0 3px 6px rgba(0,0,0,0.16), 0 3px 6px rgba(0,0,0,0.23);&quot;/&gt;&lt;br&gt;&lt;div style=&quot;color:orange; border-bottom: 1px solid #d9d9d9; display: inline-block; color: #777; font-size: 90%; padding: 1px;&quot;&gt;此处插入标题&lt;/div&gt;&lt;/div&gt;</code></td>
        </tr>
        <tr>
            <td style="text-align: center">圆角+标题</td>
            <td style="text-align: center"><div align="center" ><img src="https://img2.wlcheng.cc/images/wallpaper19.jpg" alt="wallpaper19" width="120" style="border-radius:10px;"/><br><div style="color:orange; border-bottom: 1px solid #d9d9d9; display: inline-block; color: #777; font-size: 90%; padding: 1px;">此处插入标题</div></div></td>
            <td style="text-align: "><code>&lt;div align=&quot;center&quot; &gt;&lt;img src=&quot;$url&quot; alt=&quot;$fileName&quot; width=&quot;75%&quot; style=&quot;border-radius:10px;&quot;/&gt;&lt;br&gt;&lt;div style=&quot;color:orange; border-bottom: 1px solid #d9d9d9; display: inline-block; color: #777; font-size: 90%; padding: 1px;&quot;&gt;此处插入标题&lt;/div&gt;&lt;/div&gt;</code></td>
        </tr>
        <tr>
            <td style="text-align: center">阴影+圆角+标题</td>
            <td style="text-align: center"><div align="center" ><img src="https://img2.wlcheng.cc/images/wallpaper19.jpg" alt="wallpaper19" width="120" style="box-shadow: 0 3px 6px rgba(0,0,0,0.16), 0 3px 6px rgba(0,0,0,0.23);border-radius:10px;"/><br><div style="color:orange; border-bottom: 1px solid #d9d9d9; display: inline-block; color: #777; font-size: 90%; padding: 1px;">此处插入标题</div></div></td>
            <td style="text-align: "><code>&lt;div align=&quot;center&quot; &gt;&lt;img src=&quot;$url&quot; alt=&quot;$fileName&quot; width=&quot;75%&quot; style=&quot;box-shadow: 0 3px 6px rgba(0,0,0,0.16), 0 3px 6px rgba(0,0,0,0.23);border-radius:10px;&quot;/&gt;&lt;br&gt;&lt;div style=&quot;color:orange; border-bottom: 1px solid #d9d9d9; display: inline-block; color: #777; font-size: 90%; padding: 1px;&quot;&gt;此处插入标题&lt;/div&gt;&lt;/div&gt;</code></td>
        </tr>
    </tbody>
  </table>
</div>
<p>其中，</p>
<p><code>width=&quot;75%&quot;</code>：控制图片大小，百分比是占整个文档宽度的比例（方便适配不同网页大小），也可以直接写成<code>width=&quot;300&quot;</code>等整数用来控制图片的绝对大小。</p>
<p><code>border-radius:10px;</code>：用来控制圆角大小。</p>
<p><code>此处插入标题</code>：为图片设置标题。</p>
<p>配置完以上自定义链接格式后，如下图，在PicGo上传界面，选定<code>custom</code>，之后就可以退出PicGo了。</p>
<div align="center" ><img src="https://img1.wlcheng.cc/images_for_blogs/20220506220650.png" alt="20220506220650" width="75%" style="box-shadow: 0 3px 6px rgba(0,0,0,0.16), 0 3px 6px rgba(0,0,0,0.23);border-radius:10px;"/></div>
<p>在Typora中，同样是拖入或者粘贴图片时，就会获取以上设置的链接到剪切板中，只需要粘贴到Typora中即可。</p>
<p>这里有一个问题是，Typora 粘贴图片时，始终会默认粘贴Markdown格式的图片链接，如前一小节所示。因此，我们要将Typora自动生成的删除，然后将剪切板中的自定义格式链接粘贴进去即可。如下图所示：</p>
<div align="center" ><img src="https://img2.wlcheng.cc/images/image-20220506231341704.png" alt="image-20220506231341704" width="75%" style="box-shadow: 0 3px 6px rgba(0,0,0,0.16), 0 3px 6px rgba(0,0,0,0.23);border-radius:10px;"/></div>
<h2 id="配置vs-code" class="headerLink">
    <a href="#%e9%85%8d%e7%bd%aevs-code" class="header-mark"></a>配置VS Code</h2><h3 id="安装-pic-go-插件" class="headerLink">
    <a href="#%e5%ae%89%e8%a3%85-pic-go-%e6%8f%92%e4%bb%b6" class="header-mark"></a>安装 Pic-Go 插件</h3><p>在 VS Code 中，安装 Pic-Go 插件，安装完成后，如下图所示填入图床配置信息：</p>
<div align="center" ><img src="https://img2.wlcheng.cc/images/20241030162158.png" alt="20241030162158" width="75%" style="box-shadow: 0 3px 6px rgba(0,0,0,0.16), 0 3px 6px rgba(0,0,0,0.23);border-radius:10px;"/></div>
<h3 id="测试图床" class="headerLink">
    <a href="#%e6%b5%8b%e8%af%95%e5%9b%be%e5%ba%8a" class="header-mark"></a>测试图床</h3><p>在任意打开的 Markdown 文件中，<strong>先复制了图片</strong>，然后在要插入图片位置按 <code>Ctrl + Alt + P</code>，VS Code 右下角弹窗显示上传成功，当前光标位置生成了图片链接，且能正常显示，则说明配置成功。</p>
<p><strong>注意：</strong> 在插入图片时，不要选定 Markdown 文件中的内容，否则 Pic-Go 会处理选定的内容，而不是已经复制到剪切板中的图片。</p>
<p><strong>参考：</strong></p>
<p>[1] <a href="https://yushuaigee.gitee.io/2021/01/14/%E4%BB%8E%E9%9B%B6%E5%BC%80%E5%A7%8B%E5%85%8D%E8%B4%B9%E6%90%AD%E5%BB%BA%E8%87%AA%E5%B7%B1%E7%9A%84%E5%8D%9A%E5%AE%A2%28%E4%BA%94%29%E2%80%94%E2%80%94Typora%20&#43;%20PicGo%20&#43;%20GitHub%20Gitee%E5%9B%BE%E5%BA%8A/" target="_blank" rel="noopener noreferrer">从零开始免费搭建自己的博客 (五)——Typora + PicGo + GitHub/Gitee 图床</a></p>]]></description></item><item><title>以我之名，去火星旅行（Send Your Name to Mars）</title><link>https://wlcheng.cc/posts/to_mars/</link><pubDate>Sun, 12 Dec 2021 13:19:28 +0800</pubDate><author><name>wlcheng</name></author><guid>https://wlcheng.cc/posts/to_mars/</guid><description><![CDATA[<p>我去不了火星，但是我的名字可以！</p>
<p>时隔两年，NASA 的第二次 <code>“Send Your Name to Mars”</code> 浪漫主义火星旅行项目又开始招募游客啦。(～￣▽￣)～</p>
<p>接下来我们就一起来看看，如何才能拿到开往火星的飞船船票（登机牌）呢？</p>
<p>首先进入我们的售票大厅：<a href="https://mars.nasa.gov/participate/send-your-name/future?utm_source=iContact&amp;utm_medium=email&amp;utm_campaign=nasas-mars-public-engagement-team&amp;utm_content=20211210-MarsNewsletter" target="_blank" rel="noopener noreferrer">免费领票处</a></p>
<div align="center" ><img src="https://img1.wlcheng.cc/images_for_blogs/20211212135139.png" alt="20211212135139" width="75%" style="box-shadow: 0 3px 6px rgba(0,0,0,0.16), 0 3px 6px rgba(0,0,0,0.23);border-radius:10px;"/></div>
<p>从上看起来是导引前台（导航栏）了，分了5个区，从左到右依次是：<code>名字</code>、<code>登机牌</code>、<code>地图</code>、<code>常客</code>、<code>学习</code>。根据颜色来看，当前应该是处于第一区的<code>名字</code>部分。对于功能大家在心里应该也有个猜测和期待。</p>
<p>好，我们就来看看这几个区具体都是干什么的。</p>
<h2 id="订票" class="headerLink">
    <a href="#%e8%ae%a2%e7%a5%a8" class="header-mark"></a>订票</h2><p>首先可以看见，在<code>名字</code>分区里，映入眼帘的是一个大大的个人信息登记台，看起来需要填写<code>姓名</code>、<code>国家</code>、<code>邮编</code>以及<code>邮箱</code>这几项个人信息。然后往下是针对收集个人信息的隐私保护说明和一个是否需要通过邮箱接收来自NASA的新闻动态通知。再往下，一个显眼的<code>SEND</code>（发送）可谓是再明白不过地告诉我们，点了这个按钮，我们就能开始我们的火星浪漫之旅（在2026年以我们的名字去旅行 ^o^y）。</p>
<p>既然走到这里，我们不妨就做好登记，预定上这趟旅行吧！填上我们的信息：</p>
<div align="center" ><img src="https://img1.wlcheng.cc/images_for_blogs/20211212142123.png" alt="20211212142123" width="75%" style="box-shadow: 0 3px 6px rgba(0,0,0,0.16), 0 3px 6px rgba(0,0,0,0.23);border-radius:10px;"/></div>
<p>做完登记，点击<code>SEND</code>提交我们的预定，只见眨眼功夫，我的登机牌就已生成（可以参考下各条信息的位置）：</p>
<div align="center" ><img src="https://img1.wlcheng.cc/images_for_blogs/BoardingPass_MyNameOnFutureMission.png" alt="BoardingPass_MyNameOnFutureMission" width="75%" style="box-shadow: 0 3px 6px rgba(0,0,0,0.16), 0 3px 6px rgba(0,0,0,0.23);border-radius:10px;"/></div>
<p>左联条码信息配着一幅“火星日出图”，水印着“<code>FUTURE MARS MISSION</code>”的计划标识，仿佛昭示着我们此行的希望和对未来的颂扬。</p>
<p>右联中间大写刻着我们所登记的名字，将承载着我们的浪漫与期盼去往这颗红色的星球。名字下方注明了我们此次旅行的出发站点（发射台）和目的地<a href="https://www.nasa.gov/image-feature/jezero-crater-mars-2020s-landing-site" target="_blank" rel="noopener noreferrer"><code>耶泽洛陨石坑</code></a>。</p>
<div class="details admonition info open">
    <div class="details-summary admonition-title">
        <span class="icon"><svg class="icon"
    xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><!-- Font Awesome Free 5.15.4 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) --><path d="M256 8C119.043 8 8 119.083 8 256c0 136.997 111.043 248 248 248s248-111.003 248-248C504 119.083 392.957 8 256 8zm0 110c23.196 0 42 18.804 42 42s-18.804 42-42 42-42-18.804-42-42 18.804-42 42-42zm56 254c0 6.627-5.373 12-12 12h-88c-6.627 0-12-5.373-12-12v-24c0-6.627 5.373-12 12-12h12v-64h-12c-6.627 0-12-5.373-12-12v-24c0-6.627 5.373-12 12-12h64c6.627 0 12 5.373 12 12v100h12c6.627 0 12 5.373 12 12v24z"/></svg></span>技巧<span class="details-icon"><svg class="icon"
    xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 512"><!-- Font Awesome Free 5.15.4 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) --><path d="M224.3 273l-136 136c-9.4 9.4-24.6 9.4-33.9 0l-22.6-22.6c-9.4-9.4-9.4-24.6 0-33.9l96.4-96.4-96.4-96.4c-9.4-9.4-9.4-24.6 0-33.9L54.3 103c9.4-9.4 24.6-9.4 33.9 0l136 136c9.5 9.4 9.5 24.6.1 34z"/></svg></span>
    </div>
    <div class="details-content">
        <div class="admonition-content">P.S. 为了接受来自世界各地的人民，NASA航空公司充分考虑到人名的多样性，对人名并未做限制，这给了一些思维清奇者自由发挥的空间😀。比如我在<code>Last Name</code>处填上姓名落款，<code>First Name</code>处填上一条寄语。妥妥的一封明信片，而且是送往火星的明信片😁。</div></div></div>
<h2 id="登机牌" class="headerLink">
    <a href="#%e7%99%bb%e6%9c%ba%e7%89%8c" class="header-mark"></a>登机牌</h2><p>即已经预定好登机牌，接下来我们就到<code>登机牌</code>区看看，是不是能够查到我们的登机牌了呢。</p>
<div align="center" ><img src="https://img1.wlcheng.cc/images_for_blogs/20211212144920.png" alt="20211212144920" width="75%" style="box-shadow: 0 3px 6px rgba(0,0,0,0.16), 0 3px 6px rgba(0,0,0,0.23);border-radius:10px;"/></div>
<p>填好预定时的信息，点击下面的<code>FIND</code>，就能查到我们的登机牌信息了，可以再次下载、打印或者嵌入网页。</p>
<h2 id="地图" class="headerLink">
    <a href="#%e5%9c%b0%e5%9b%be" class="header-mark"></a>地图</h2><p>总算来到<code>地图</code>区了，让我们来看看：</p>
<div align="center" ><img src="https://img1.wlcheng.cc/images_for_blogs/20211212145449.png" alt="20211212145449" width="75%" style="box-shadow: 0 3px 6px rgba(0,0,0,0.16), 0 3px 6px rgba(0,0,0,0.23);border-radius:10px;"/></div>
<p>一眼就盯到我们泱泱种花家深沉的颜色，再看右侧的排名，果然咱高居榜首，竟然已经有400多万的先行者👍。在看排行榜底部，截止我的购票日期，这购票人数已达到2000多万。但相对于全球79亿人来说还只是极少数，这么说我们也已经走在了世界前<code>3‰</code>列了呢😄。</p>
<h2 id="常客" class="headerLink">
    <a href="#%e5%b8%b8%e5%ae%a2" class="header-mark"></a>常客</h2><p>常客常客，应该是指的第一次的火星之旅吧。我来查一查是否还有曾经的我的名字：</p>
<div align="center" ><img src="https://img1.wlcheng.cc/images_for_blogs/20211212151033.png" alt="20211212151033" width="75%" style="box-shadow: 0 3px 6px rgba(0,0,0,0.16), 0 3px 6px rgba(0,0,0,0.23);border-radius:10px;"/></div>
<div align="center" ><img src="https://img1.wlcheng.cc/images_for_blogs/20211212151556.png" alt="20211212151556" width="75%" style="box-shadow: 0 3px 6px rgba(0,0,0,0.16), 0 3px 6px rgba(0,0,0,0.23);border-radius:10px;"/></div>
<p>嗯，很棒！2019年预定，2020年7月20日毅力号发射，2021年2月18日登陆耶泽洛陨石坑。</p>
<h2 id="我们的名字在哪里" class="headerLink">
    <a href="#%e6%88%91%e4%bb%ac%e7%9a%84%e5%90%8d%e5%ad%97%e5%9c%a8%e5%93%aa%e9%87%8c" class="header-mark"></a>我们的名字在哪里？</h2><p>进入<code>学习</code>区，发现我们的初心。</p>
<div align="center" ><img src="https://mars.nasa.gov/system/news_items/main_images/8872_Perseverance_SYN_chip_on_Mars_30fps_optimized.gif" alt="20211212151821" width="75%" style="box-shadow: 0 3px 6px rgba(0,0,0,0.16), 0 3px 6px rgba(0,0,0,0.23);border-radius:10px;"/></div>
<div align="center" ><img src="https://img1.wlcheng.cc/images_for_blogs/20211212153141.png" alt="20211212153141" width="75%" style="box-shadow: 0 3px 6px rgba(0,0,0,0.16), 0 3px 6px rgba(0,0,0,0.23);border-radius:10px;"/></div>
<p>就在这小小的悬架上面，我们的名字静静地躺着，仰望着满天星河</p>
<p>随着毅力号的前进，我们将看尽日升日出垂落漠，宇宙山川枯银河</p>
<p>几个字节的数据，仿佛牵系着我的灵魂</p>
<p>当我在蓝色星球上彷徨时，会想起在孤寂的红色大地上</p>
<p>有你，在以坚定的意志，探索前进</p>
<p>我们的名字，承载着毅力，在前进！</p>]]></description></item><item><title>Cisco Packet Tracer 学习 —— 安装</title><link>https://wlcheng.cc/posts/cisco_packet_tracer_install/</link><pubDate>Tue, 12 Oct 2021 11:00:17 +0800</pubDate><author><name>wlcheng</name></author><guid>https://wlcheng.cc/posts/cisco_packet_tracer_install/</guid><description><![CDATA[<p>思科网络仿真工具 Cisco Packet Tracer 学习系列之一：软件获取及安装。</p>
<h2 id="注册账号" class="headerLink">
    <a href="#%e6%b3%a8%e5%86%8c%e8%b4%a6%e5%8f%b7" class="header-mark"></a>注册账号</h2><p>在<a href="https://id.cisco.com/signin/register" target="_blank" rel="noopener noreferrer">Cisco Packet Tracer</a>填写信息进行注册。</p>
<div align="center" ><img src="https://img1.wlcheng.cc/images_for_blogs/20211012200321.png" alt="20211012200321" width="75%" style="box-shadow: 0 3px 6px rgba(0,0,0,0.16), 0 3px 6px rgba(0,0,0,0.23);border-radius:0px;"/></div>
<h2 id="安装软件" class="headerLink">
    <a href="#%e5%ae%89%e8%a3%85%e8%bd%af%e4%bb%b6" class="header-mark"></a>安装软件</h2><h3 id="下载安装" class="headerLink">
    <a href="#%e4%b8%8b%e8%bd%bd%e5%ae%89%e8%a3%85" class="header-mark"></a>下载安装</h3><p>在 Cisco Networking Academy 网页登录账号后，下载 Cisco Packet Tracer 安装包：</p>
<div align="center" ><img src="https://img1.wlcheng.cc/images_for_blogs/20211012195347.png" alt="20211012195347" width="75%" style="box-shadow: 0 3px 6px rgba(0,0,0,0.16), 0 3px 6px rgba(0,0,0,0.23);border-radius:0px;"/></div>
<p>打开下载的安装包，执行安装程序：</p>
<div align="center" ><img src="https://img1.wlcheng.cc/images_for_blogs/20211012193421.png" alt="20211012193421" width="75%" style="box-shadow: 0 3px 6px rgba(0,0,0,0.16), 0 3px 6px rgba(0,0,0,0.23);border-radius:0px;"/></div>
<h3 id="启动登录" class="headerLink">
    <a href="#%e5%90%af%e5%8a%a8%e7%99%bb%e5%bd%95" class="header-mark"></a>启动登录</h3><p>启动界面：</p>
<div align="center" ><img src="https://img1.wlcheng.cc/images_for_blogs/20211012190239.png" alt="20211012190239" width="75%" style="box-shadow: 0 3px 6px rgba(0,0,0,0.16), 0 3px 6px rgba(0,0,0,0.23);border-radius:0px;"/></div>
<p>首次启动需要登录我们前面注册的 Cisco Networking Academy 账号。此处勾选上<code>Keep me logged in</code>选项，能够3个月免手动登录。</p>
<div align="center" ><img src="https://img1.wlcheng.cc/images_for_blogs/20211012190630.png" alt="20211012190630" width="75%" style="box-shadow: 0 3px 6px rgba(0,0,0,0.16), 0 3px 6px rgba(0,0,0,0.23);border-radius:0px;"/></div>
<p>依次输入账号、密码，点击<code>Log in</code>按钮完成登录。</p>
<div align="center" ><img src="https://img1.wlcheng.cc/images_for_blogs/20211012190830.png" alt="20211012190830" width="75%" style="box-shadow: 0 3px 6px rgba(0,0,0,0.16), 0 3px 6px rgba(0,0,0,0.23);border-radius:0px;"/></div>
<p>登录后，会自动打开软件主界面，如下：</p>
<div align="center" ><img src="https://img1.wlcheng.cc/images_for_blogs/20211012191044.png" alt="20211012191044" width="75%" style="box-shadow: 0 3px 6px rgba(0,0,0,0.16), 0 3px 6px rgba(0,0,0,0.23);border-radius:0px;"/></div>
<h3 id="修改语言" class="headerLink">
    <a href="#%e4%bf%ae%e6%94%b9%e8%af%ad%e8%a8%80" class="header-mark"></a>修改语言</h3><p>下载语言包文件：在<a href="https://www.netacad.com/portal/resources/browse/341e11c1-d03f-4433-9413-29b9d207e7eb" target="_blank" rel="noopener noreferrer">列表</a>中找到<code>Simplified Chinese.ptl</code>点击下载。</p>
<div align="center" ><img src="https://img1.wlcheng.cc/images_for_blogs/20211012195854.png" alt="20211012195854" width="75%" style="box-shadow: 0 3px 6px rgba(0,0,0,0.16), 0 3px 6px rgba(0,0,0,0.23);border-radius:0px;"/></div>
<p>将下载的语言包文件拷贝到 Cisco Packet Tracer的安装目录（根据自己的安装目录而定）下的<code>language</code>文件夹下：</p>
<div align="center" ><img src="https://img1.wlcheng.cc/images_for_blogs/20211012185836.png" alt="20211012185836" width="75%" style="box-shadow: 0 3px 6px rgba(0,0,0,0.16), 0 3px 6px rgba(0,0,0,0.23);border-radius:0px;"/></div>
<p>打开 Cisco Packet Tracer</p>
<ol>
<li>从菜单上依次点击 <code>Options</code>|<code>Preferences</code>；</li>
<li>Translator 框中，选定<code>Simplified Chinese</code>；</li>
<li>点击 <code>Change Language</code>；</li>
<li>弹出框提示&quot;将在下次打开软件时生效。点<code>OK</code>。</li>
</ol>
<div align="center" ><img src="https://img1.wlcheng.cc/images_for_blogs/20211012193452.png" alt="20211012193452" width="75%" style="box-shadow: 0 3px 6px rgba(0,0,0,0.16), 0 3px 6px rgba(0,0,0,0.23);border-radius:0px;"/></div>
<ol start="5">
<li>关闭软件并重新打开查看是否修改成功。</li>
</ol>
<div align="center" ><img src="https://img1.wlcheng.cc/images_for_blogs/2fRmYKyAoM.gif" alt="2fRmYKyAoM" width="75%" style="box-shadow: 0 3px 6px rgba(0,0,0,0.16), 0 3px 6px rgba(0,0,0,0.23);border-radius:0px;"/></div>
<p>搭好环境，下一篇正式开始学习使用。p.s. 下一篇暂无。</p>]]></description></item><item><title>Word 压缩</title><link>https://wlcheng.cc/posts/word%E5%8E%8B%E7%BC%A9/</link><pubDate>Fri, 20 Aug 2021 21:23:58 +0800</pubDate><author><name>wlcheng</name></author><guid>https://wlcheng.cc/posts/word%E5%8E%8B%E7%BC%A9/</guid><description><![CDATA[<p>应老师要求，把一个 30 多 MB 的 Word 文件压缩到 5MB 以内。一番探索，得出一套通过批量压缩 Word 中图片，以压缩 Word 的方案，记录于此。</p>
<p><strong>精简版：</strong></p>
<ol>
<li><strong>初步压缩：</strong> 打开 Word，任选一张图片-&gt;点菜单栏上<code>格式</code>-&gt;左侧<code>压缩图片</code>-&gt;去掉勾选<code>仅应用于此图片</code>，勾选 <code>96 ppi</code>，点<code>确定</code>，保存文件；</li>
<li><strong>提取图片：</strong> 把 Word 文件后缀 <code>docx</code> 改成 <code>zip</code>，然后解压，解压文件夹下路径 word/media 里就是所有的图片了；</li>
<li><strong>批量压缩：</strong> 打开<a href="https://www.iloveimg.com/zh-cn/compress-image" target="_blank" rel="noopener noreferrer">iloveimg</a> 批量压缩图片，一次最多 30 张，下载并替换本地图片；</li>
<li><strong>恢复 Word：</strong> 把 word/media 下的图片替换成压缩后的图片，然后把整个文件夹压缩成 Zip，再把后缀 Zip 改回 docx 即可。</li>
</ol>
<p><strong>啰嗦版↓</strong></p>
<h3 id="需求评估" class="headerLink">
    <a href="#%e9%9c%80%e6%b1%82%e8%af%84%e4%bc%b0" class="header-mark"></a>需求评估</h3><h4 id="需求" class="headerLink">
    <a href="#%e9%9c%80%e6%b1%82" class="header-mark"></a>需求</h4><p>现在 10 点，将这个 Word 文件压缩至 5M 以下，12 点前返回。💔</p>
<h4 id="原材料" class="headerLink">
    <a href="#%e5%8e%9f%e6%9d%90%e6%96%99" class="header-mark"></a>原材料</h4><p>所给文件是 <code>docx</code> 格式的 Word 文档，总大小 35MB；内含 73 张 <code>png</code> 格式截图，每张图占满一页；截图是期刊论文的首页截图，文字内容小且多，要尽量保证清晰。</p>
<p>上个全景图看看😲</p>
<div align="center"><img src="https://i.loli.net/2021/08/20/RNfZVojaKEkx4Py.png" alt="20210820214122" width="600" align="center"/></div>
<h4 id="分析与准备" class="headerLink">
    <a href="#%e5%88%86%e6%9e%90%e4%b8%8e%e5%87%86%e5%a4%87" class="header-mark"></a>分析与准备</h4><p>时间紧，任务重，得高效解决。初步分析，涉及三点：</p>
<ul>
<li>
<p><strong>压缩：</strong> 由于文件内文字不多，首先忽略文字占用。那么总共 73 张图片，平均每张图片就得压缩至 68KB 以下。压缩图片来说，倒是有很多网站可以做到的，厉害点的还可以自由调整压缩比、分辨率等。</p>
</li>
<li>
<p><strong>批量：</strong> 压缩能解决了，但文件太多，不可能一张一张的去压缩再替换，既耗时又低效。这种重复工作一定要一定要批量处理。所幸 <a href="https://www.iloveimg.com/zh-cn/compress-image" target="_blank" rel="noopener noreferrer">iloveimg</a> 这个网站也是支持批量处理的，只不过一次处理最多 30 张图片，73张图片处理3次，可以接受。</p>
</li>
<li>
<p><strong>Word图片导出：</strong> 既然<strong>批量</strong>和<strong>压缩</strong>都能解决了，但图片还都在 Word 里面呢，总不能一张一张<strong>另存为</strong>吧。工具软件或者 Word 插件当然是有的，批量提取 Word 中的图片，但一个更朴素的方法当然是 <strong>解压 Word 文件</strong> 😄。因为 <code>docx</code>格式的 Word 文档基于 OpenXML 标准，而这个标准是基于 <code>Zip</code> 压缩格式的。</p>
</li>
</ul>
<h3 id="压缩方案" class="headerLink">
    <a href="#%e5%8e%8b%e7%bc%a9%e6%96%b9%e6%a1%88" class="header-mark"></a>压缩方案</h3><ol>
<li>
<p><strong>初步压缩：</strong> 先打开 Word，随便选定一张图片，点菜单栏最后的格式栏，点击左侧压缩图片，去掉勾选 仅应用于此图片，勾选 电子邮件 (96 ppi) 的分辨率，点确定，记得保存修改。</p>
</li>
<li>
<p><strong>提取图片：</strong> 把 Word 文件后缀 .docx 改成 zip，然后解压，解压后的文件夹里路径 word/media 下就是所有的图片了；</p>
</li>
<li>
<p><strong>批量压缩：</strong> 用这个网页工具 <a href="https://www.iloveimg.com/zh-cn/compress-image" target="_blank" rel="noopener noreferrer">iloveimg</a> 批量压缩图片，一次最多 30 张图片。一般直接能压缩到 100k 以下，但如果压缩后还是太大，可以再次上传压缩；</p>
</li>
<li>
<p><strong>恢复 Word：</strong> 把 word/media 下的所有图片替换成压缩后的图片，然后把整个文件夹压缩成 zip 格式，再把后缀 zip 改回 docx 即可。</p>
</li>
<li>
<p><strong>转 pdf：</strong> Word 转成 pdf，最好是用 adobe（1. Word 上右键菜单里转换为 Adobe PDF 文件，2. 或者打开 adobe 后 从文件创建 PDF 后，选 Word 文件即可）。Word 自带的导出和另存为大概率导出的 pdf 会比 Word 要大。</p>
</li>
</ol>
<h3 id="总结" class="headerLink">
    <a href="#%e6%80%bb%e7%bb%93" class="header-mark"></a>总结</h3><p>以上方案只能说是手动，更好的当然是能直接一个操作然后实现以上步骤的自动执行。不过目前能力不足，只能到此。</p>]]></description></item><item><title>PowerShell 美化</title><link>https://wlcheng.cc/posts/powershell%E7%BE%8E%E5%8C%96/</link><pubDate>Thu, 19 Aug 2021 17:40:30 +0800</pubDate><author><name>wlcheng</name></author><guid>https://wlcheng.cc/posts/powershell%E7%BE%8E%E5%8C%96/</guid><description><![CDATA[<p>记录新版 PowerShell 美化过程。</p>
<h3 id="安装-windows-terminal" class="headerLink">
    <a href="#%e5%ae%89%e8%a3%85-windows-terminal" class="header-mark"></a>安装 Windows Terminal</h3><p>可以在微软商店 (Microsoft Store) 搜索 <code>Windows Terminal</code> 安装。</p>
<p>商城搜索结果会有多种版本的Windows Terminal (以下将简称为Terminal)，不知选哪个的话，可直接点击此处链接 <a href="https://www.microsoft.com/store/productId/9N0DX20HK701" target="_blank" rel="noopener noreferrer">Windows Terminal - 微软商店</a>，然后点击<code>获取</code>，弹出框中同意<code>打开</code>电脑的微软商城，跳转到软件主页后，直接<code>安装</code>即可。安装过程无需做任何选项与设置，就像在手机上的软件商城中搜索软件进行安装一样简单。</p>
<p>当然，如果想体验最新功能，可以去官方Github发布页获取最新预览版本：<a href="https://github.com/microsoft/terminal/releases" target="_blank" rel="noopener noreferrer">Windows Terminal - Github</a></p>
<p>安装完后的 Windows Terminal，可以在系统开始菜单找到并打开。先看一下美化前的样子。</p>
<figure><a class="lightgallery" href="https://i.loli.net/2021/08/19/bTVWEIBykK74J3Y.png" title="" data-thumbnail="https://i.loli.net/2021/08/19/bTVWEIBykK74J3Y.png" data-sub-html="<h2>美化之前的PowerShell</h2>"><img  loading="lazy" src='https://i.loli.net/2021/08/19/bTVWEIBykK74J3Y.png'     width="600"></a><figcaption class="image-caption">美化之前的PowerShell</figcaption>
    </figure>
<p>朴实无华，看着其实也还不错。</p>
<p>可以看到Terminal的多窗口是标签化管理的，大为方便软件内的切换。而菜单栏上右侧的 <code>+</code>号可以快速开启一个默认类型的窗口。<code>﹀</code>下拉菜单可以选择各类终端窗口。</p>
<p>然后看一下终端显示的内容。因为要美化的是PowerShell，我便打开了一个Windows PowerShell窗口，键入命令 <code>$PSVersionTable</code>后回车，可以看到当前PowerShell的版本号为<code>5.1</code>，仍然是老版本。之后我们要将其换成 <strong>开源跨平台的船新版本</strong>。请看下文~</p>
<h3 id="安装-powershell" class="headerLink">
    <a href="#%e5%ae%89%e8%a3%85-powershell" class="header-mark"></a>安装 PowerShell</h3><h4 id="更新-从-microsoft-store-安装" class="headerLink">
    <a href="#%e6%9b%b4%e6%96%b0-%e4%bb%8e-microsoft-store-%e5%ae%89%e8%a3%85" class="header-mark"></a>(更新) 从 Microsoft Store 安装</h4><p>微软商城搜索 <a href="https://www.microsoft.com/store/productId/9P95ZZKTNRN4" target="_blank" rel="noopener noreferrer">PowerShell Preview</a> ，安装即可。官方渠道，可以自动更新，无需重复配置环境。</p>
<p>安装完成后，重新打开 Terminal。</p>
<h4 id="从-github-下载安装" class="headerLink">
    <a href="#%e4%bb%8e-github-%e4%b8%8b%e8%bd%bd%e5%ae%89%e8%a3%85" class="header-mark"></a>从 Github 下载安装</h4><p>采用此种方式的话，之后需要自己手动下载新版本安装包，并重新进行后续的美化配置。</p>
<p>船新版本在哪里？当然看准官方发布渠道，我选了最新预览版：<a href="https://github.com/PowerShell/PowerShell/releases/tag/v7.2.0-preview.8" target="_blank" rel="noopener noreferrer">PowerShell</a></p>
<p>可以观察到，曾经的PowerShell 全名为 <code>Windows PowerShell</code>，但是现在去掉了前面的<code>Windows</code>，只留<code>PowerShell</code>一词；另外发布页的 <code>Assets</code>中也确实提供了各种平台的版本。这无疑是名副其实的跨平台了。</p>
<p>言归正传，从上面官方发布页中，我选择了 <code>7.2.0-preview-win-x64</code> 版本的<code>msi</code>安装包。下载下来安装包后，直接双击运行，会经历以下步骤，最后还有一个对话框点击<code>install</code>即可。</p>
<p>这个船新版本的船新 Logo 灰常 Cyber 的说。</p>
<div align="center"><img src="https://i.loli.net/2021/08/19/KvypYTghufJCE4H.png" alt="20210819231541" width="600" align="center"/></div>
<h4 id="添加-powershell-到-terminal" class="headerLink">
    <a href="#%e6%b7%bb%e5%8a%a0-powershell-%e5%88%b0-terminal" class="header-mark"></a>添加 PowerShell 到 Terminal</h4><blockquote>
  <p>如果前面从Microsoft Store安装的PowerShell，一般会自动添加到 Temianl 中。如果没有的话，按照下面步骤自行添加即可。</p>
</blockquote><p>打开 Terminal，点开菜单栏右侧下拉菜单，点击<code>设置</code>；或者直接按快捷键 <code>Ctrl + ,</code>，调出设置界面，按照下图步骤添加我们安装的 PowerShell 到Terminal中：</p>
<div align="center"><img src="https://i.loli.net/2021/08/19/6aWpghFBPXd4Djk.png" alt="20210819233300" width="600" align="center"/></div>
<blockquote>
  <p>从 Microsoft Store 安装的 PowerShell，安装目录为：<code>&quot;C:\Users\用户名\AppData\Local\Microsoft\WindowsApps\Microsoft.PowerShellPreview_8wekyb3d8bbwe\pwsh.exe&quot;</code>，将此目录添加到上图的<code>命令行</code>位置即可。</p>
</blockquote><p>注意添加完后，点击<code>保存</code>。</p>
<p>Terminal无需重启即可即时更新配置，从下拉菜单中看到 PowerShell 7 已经添加成功。</p>
<div align="center"><img src="https://i.loli.net/2021/08/19/6JEc9fpPvhRx5Mk.png" alt="20210819233953" width="600" align="center"/></div>
<p>下面开始我们的美化之路。</p>
<h3 id="美化-powershell" class="headerLink">
    <a href="#%e7%be%8e%e5%8c%96-powershell" class="header-mark"></a>美化 PowerShell</h3><h4 id="安装-on-my-posh" class="headerLink">
    <a href="#%e5%ae%89%e8%a3%85-on-my-posh" class="header-mark"></a>安装 on-my-posh</h4><p>方法一：（更新）直接在 Microsoft Store 中搜索 <code>oh-my-posh</code> 并安装。</p>
<p>方法二：打开 Terminal，然后打开一个 PowerShell 窗口。命令行中执行以下命令安装 oh-my-posh 模块：</p>
<div class="code-block highlight is-open show-line-numbers  tw-group tw-my-2">
  <div class="
    code-block-title 
    
    tw-flex 
    tw-flex-row 
    tw-justify-between 
    tw-w-full tw-bg-bgColor-secondary
    ">      
    <button 
      class="
        tw-select-none 
        tw-mx-2 
        tw-block
        group-[.is-open]:tw-rotate-90
        tw-transition-[transform] 
        tw-duration-500 
        tw-ease-in-out
        print:!tw-hidden"
      disabled
      aria-hidden="true"><svg class="icon"
    xmlns="http://www.w3.org/2000/svg" viewBox="0 0 320 512"><!-- Font Awesome Free 5.15.4 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) --><path d="M285.476 272.971L91.132 467.314c-9.373 9.373-24.569 9.373-33.941 0l-22.667-22.667c-9.357-9.357-9.375-24.522-.04-33.901L188.505 256 34.484 101.255c-9.335-9.379-9.317-24.544.04-33.901l22.667-22.667c9.373-9.373 24.569-9.373 33.941 0L285.475 239.03c9.373 9.372 9.373 24.568.001 33.941z"/></svg></button>

    <div class="code-block-title-bar tw-w-full">
      <p class="tw-select-none !tw-my-1">powershell</p>
    </div>
    <div class="tw-flex">
      <button 
        class="
          line-number-button
          tw-select-none 
          tw-mx-2 
          tw-hidden 
          group-[.is-open]:tw-block 
          group-[.show-line-numbers]:tw-text-fgColor-link 
          print:!tw-hidden" 
        title="Toggle line numbers"><svg class="icon"
    xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><!-- Font Awesome Free 5.15.4 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) --><path d="M61.77 401l17.5-20.15a19.92 19.92 0 0 0 5.07-14.19v-3.31C84.34 356 80.5 352 73 352H16a8 8 0 0 0-8 8v16a8 8 0 0 0 8 8h22.83a157.41 157.41 0 0 0-11 12.31l-5.61 7c-4 5.07-5.25 10.13-2.8 14.88l1.05 1.93c3 5.76 6.29 7.88 12.25 7.88h4.73c10.33 0 15.94 2.44 15.94 9.09 0 4.72-4.2 8.22-14.36 8.22a41.54 41.54 0 0 1-15.47-3.12c-6.49-3.88-11.74-3.5-15.6 3.12l-5.59 9.31c-3.72 6.13-3.19 11.72 2.63 15.94 7.71 4.69 20.38 9.44 37 9.44 34.16 0 48.5-22.75 48.5-44.12-.03-14.38-9.12-29.76-28.73-34.88zM496 224H176a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16h320a16 16 0 0 0 16-16v-32a16 16 0 0 0-16-16zm0-160H176a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16h320a16 16 0 0 0 16-16V80a16 16 0 0 0-16-16zm0 320H176a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16h320a16 16 0 0 0 16-16v-32a16 16 0 0 0-16-16zM16 160h64a8 8 0 0 0 8-8v-16a8 8 0 0 0-8-8H64V40a8 8 0 0 0-8-8H32a8 8 0 0 0-7.14 4.42l-8 16A8 8 0 0 0 24 64h8v64H16a8 8 0 0 0-8 8v16a8 8 0 0 0 8 8zm-3.91 160H80a8 8 0 0 0 8-8v-16a8 8 0 0 0-8-8H41.32c3.29-10.29 48.34-18.68 48.34-56.44 0-29.06-25-39.56-44.47-39.56-21.36 0-33.8 10-40.46 18.75-4.37 5.59-3 10.84 2.8 15.37l8.58 6.88c5.61 4.56 11 2.47 16.12-2.44a13.44 13.44 0 0 1 9.46-3.84c3.33 0 9.28 1.56 9.28 8.75C51 248.19 0 257.31 0 304.59v4C0 316 5.08 320 12.09 320z"/></svg></button>

      <button 
        class="
          wrap-code-button
          tw-select-none 
          tw-mx-2 
          tw-hidden 
          group-[.is-open]:tw-block 
          group-[.is-wrap]:tw-text-fgColor-link 
          print:!tw-hidden" 
        title="Toggle code wrap"><svg class="icon"
    xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><!-- Font Awesome Free 5.15.4 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) --><path d="M16 132h416c8.837 0 16-7.163 16-16V76c0-8.837-7.163-16-16-16H16C7.163 60 0 67.163 0 76v40c0 8.837 7.163 16 16 16zm0 160h416c8.837 0 16-7.163 16-16v-40c0-8.837-7.163-16-16-16H16c-8.837 0-16 7.163-16 16v40c0 8.837 7.163 16 16 16zm0 160h416c8.837 0 16-7.163 16-16v-40c0-8.837-7.163-16-16-16H16c-8.837 0-16 7.163-16 16v40c0 8.837 7.163 16 16 16z"/></svg></button>
      
      <button 
        class="
          copy-code-button
          tw-select-none
          tw-mx-2 
          tw-hidden
          group-[.is-open]:tw-block
          hover:tw-text-fgColor-link 
          print:!tw-hidden"
        title="Copy code">
          <span class="copy-icon tw-block"><svg class="icon"
    xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><!-- Font Awesome Free 5.15.4 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) --><path d="M433.941 65.941l-51.882-51.882A48 48 0 0 0 348.118 0H176c-26.51 0-48 21.49-48 48v48H48c-26.51 0-48 21.49-48 48v320c0 26.51 21.49 48 48 48h224c26.51 0 48-21.49 48-48v-48h80c26.51 0 48-21.49 48-48V99.882a48 48 0 0 0-14.059-33.941zM266 464H54a6 6 0 0 1-6-6V150a6 6 0 0 1 6-6h74v224c0 26.51 21.49 48 48 48h96v42a6 6 0 0 1-6 6zm128-96H182a6 6 0 0 1-6-6V54a6 6 0 0 1 6-6h106v88c0 13.255 10.745 24 24 24h88v202a6 6 0 0 1-6 6zm6-256h-64V48h9.632c1.591 0 3.117.632 4.243 1.757l48.368 48.368a6 6 0 0 1 1.757 4.243V112z"/></svg></span>
          <span class="check-icon tw-hidden"><svg class="icon"
    xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><!-- Font Awesome Free 5.15.4 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) --><path d="M173.898 439.404l-166.4-166.4c-9.997-9.997-9.997-26.206 0-36.204l36.203-36.204c9.997-9.998 26.207-9.998 36.204 0L192 312.69 432.095 72.596c9.997-9.997 26.207-9.997 36.204 0l36.203 36.204c9.997 9.997 9.997 26.206 0 36.204l-294.4 294.401c-9.998 9.997-26.207 9.997-36.204-.001z"/></svg></span>
      </button>
        
      <button 
        class="
          tw-select-none 
          tw-mx-2 
          tw-block 
          group-[.is-open]:tw-hidden 
          print:!tw-hidden" 
        disabled
        aria-hidden="true"><svg class="icon"
    xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><!-- Font Awesome Free 5.15.4 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) --><path d="M328 256c0 39.8-32.2 72-72 72s-72-32.2-72-72 32.2-72 72-72 72 32.2 72 72zm104-72c-39.8 0-72 32.2-72 72s32.2 72 72 72 72-32.2 72-72-32.2-72-72-72zm-352 0c-39.8 0-72 32.2-72 72s32.2 72 72 72 72-32.2 72-72-32.2-72-72-72z"/></svg></button>
    </div>
  </div>
  <pre style="counter-reset: codeblock;" class="tw-block tw-m-0 tw-p-0"><code 
    id="codeblock-id-1" 
    class="
      chroma 
      !tw-block 
      tw-p-0
      tw-m-0
      tw-transition-[max-height] 
      tw-duration-500 
      tw-ease-in-out 
      group-[.is-closed]:!tw-max-h-0 
      group-[.is-wrap]:tw-text-wrap
      tw-overflow-y-hidden
      tw-overflow-x-auto
      tw-scrollbar-thin
      "><span class="line"><span class="cl"><span class="nb">Install-Module</span> <span class="nb">oh-my</span><span class="n">-posh</span> <span class="n">-Scope</span> <span class="n">CurrentUser</span></span></span></code></pre>
</div>
<h4 id="设置主题" class="headerLink">
    <a href="#%e8%ae%be%e7%bd%ae%e4%b8%bb%e9%a2%98" class="header-mark"></a>设置主题</h4><p>安装完成后，执行 <code>Get-PoshThemes</code> 命令，将以各自主题的样式列出支持的主题。</p>
<div align="center"><img src="https://i.loli.net/2021/08/20/fcC8YDQwJAvxX62.png" alt="Snipaste_2021-08-20_00-51-01" width="600" align="center"/></div>
<p>其中有一些乱码，这实际是一些图标，需要安装字体包来提供图标支持，具体方法后续给出。</p>
<p>先进行主题设置。选择主题可以从以上命令的返回结果中选择自己中意的，然后执行以下命令就能进行安装：</p>
<div class="code-block highlight is-open show-line-numbers  tw-group tw-my-2">
  <div class="
    code-block-title 
    
    tw-flex 
    tw-flex-row 
    tw-justify-between 
    tw-w-full tw-bg-bgColor-secondary
    ">      
    <button 
      class="
        tw-select-none 
        tw-mx-2 
        tw-block
        group-[.is-open]:tw-rotate-90
        tw-transition-[transform] 
        tw-duration-500 
        tw-ease-in-out
        print:!tw-hidden"
      disabled
      aria-hidden="true"><svg class="icon"
    xmlns="http://www.w3.org/2000/svg" viewBox="0 0 320 512"><!-- Font Awesome Free 5.15.4 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) --><path d="M285.476 272.971L91.132 467.314c-9.373 9.373-24.569 9.373-33.941 0l-22.667-22.667c-9.357-9.357-9.375-24.522-.04-33.901L188.505 256 34.484 101.255c-9.335-9.379-9.317-24.544.04-33.901l22.667-22.667c9.373-9.373 24.569-9.373 33.941 0L285.475 239.03c9.373 9.372 9.373 24.568.001 33.941z"/></svg></button>

    <div class="code-block-title-bar tw-w-full">
      <p class="tw-select-none !tw-my-1">powershell</p>
    </div>
    <div class="tw-flex">
      <button 
        class="
          line-number-button
          tw-select-none 
          tw-mx-2 
          tw-hidden 
          group-[.is-open]:tw-block 
          group-[.show-line-numbers]:tw-text-fgColor-link 
          print:!tw-hidden" 
        title="Toggle line numbers"><svg class="icon"
    xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><!-- Font Awesome Free 5.15.4 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) --><path d="M61.77 401l17.5-20.15a19.92 19.92 0 0 0 5.07-14.19v-3.31C84.34 356 80.5 352 73 352H16a8 8 0 0 0-8 8v16a8 8 0 0 0 8 8h22.83a157.41 157.41 0 0 0-11 12.31l-5.61 7c-4 5.07-5.25 10.13-2.8 14.88l1.05 1.93c3 5.76 6.29 7.88 12.25 7.88h4.73c10.33 0 15.94 2.44 15.94 9.09 0 4.72-4.2 8.22-14.36 8.22a41.54 41.54 0 0 1-15.47-3.12c-6.49-3.88-11.74-3.5-15.6 3.12l-5.59 9.31c-3.72 6.13-3.19 11.72 2.63 15.94 7.71 4.69 20.38 9.44 37 9.44 34.16 0 48.5-22.75 48.5-44.12-.03-14.38-9.12-29.76-28.73-34.88zM496 224H176a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16h320a16 16 0 0 0 16-16v-32a16 16 0 0 0-16-16zm0-160H176a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16h320a16 16 0 0 0 16-16V80a16 16 0 0 0-16-16zm0 320H176a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16h320a16 16 0 0 0 16-16v-32a16 16 0 0 0-16-16zM16 160h64a8 8 0 0 0 8-8v-16a8 8 0 0 0-8-8H64V40a8 8 0 0 0-8-8H32a8 8 0 0 0-7.14 4.42l-8 16A8 8 0 0 0 24 64h8v64H16a8 8 0 0 0-8 8v16a8 8 0 0 0 8 8zm-3.91 160H80a8 8 0 0 0 8-8v-16a8 8 0 0 0-8-8H41.32c3.29-10.29 48.34-18.68 48.34-56.44 0-29.06-25-39.56-44.47-39.56-21.36 0-33.8 10-40.46 18.75-4.37 5.59-3 10.84 2.8 15.37l8.58 6.88c5.61 4.56 11 2.47 16.12-2.44a13.44 13.44 0 0 1 9.46-3.84c3.33 0 9.28 1.56 9.28 8.75C51 248.19 0 257.31 0 304.59v4C0 316 5.08 320 12.09 320z"/></svg></button>

      <button 
        class="
          wrap-code-button
          tw-select-none 
          tw-mx-2 
          tw-hidden 
          group-[.is-open]:tw-block 
          group-[.is-wrap]:tw-text-fgColor-link 
          print:!tw-hidden" 
        title="Toggle code wrap"><svg class="icon"
    xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><!-- Font Awesome Free 5.15.4 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) --><path d="M16 132h416c8.837 0 16-7.163 16-16V76c0-8.837-7.163-16-16-16H16C7.163 60 0 67.163 0 76v40c0 8.837 7.163 16 16 16zm0 160h416c8.837 0 16-7.163 16-16v-40c0-8.837-7.163-16-16-16H16c-8.837 0-16 7.163-16 16v40c0 8.837 7.163 16 16 16zm0 160h416c8.837 0 16-7.163 16-16v-40c0-8.837-7.163-16-16-16H16c-8.837 0-16 7.163-16 16v40c0 8.837 7.163 16 16 16z"/></svg></button>
      
      <button 
        class="
          copy-code-button
          tw-select-none
          tw-mx-2 
          tw-hidden
          group-[.is-open]:tw-block
          hover:tw-text-fgColor-link 
          print:!tw-hidden"
        title="Copy code">
          <span class="copy-icon tw-block"><svg class="icon"
    xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><!-- Font Awesome Free 5.15.4 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) --><path d="M433.941 65.941l-51.882-51.882A48 48 0 0 0 348.118 0H176c-26.51 0-48 21.49-48 48v48H48c-26.51 0-48 21.49-48 48v320c0 26.51 21.49 48 48 48h224c26.51 0 48-21.49 48-48v-48h80c26.51 0 48-21.49 48-48V99.882a48 48 0 0 0-14.059-33.941zM266 464H54a6 6 0 0 1-6-6V150a6 6 0 0 1 6-6h74v224c0 26.51 21.49 48 48 48h96v42a6 6 0 0 1-6 6zm128-96H182a6 6 0 0 1-6-6V54a6 6 0 0 1 6-6h106v88c0 13.255 10.745 24 24 24h88v202a6 6 0 0 1-6 6zm6-256h-64V48h9.632c1.591 0 3.117.632 4.243 1.757l48.368 48.368a6 6 0 0 1 1.757 4.243V112z"/></svg></span>
          <span class="check-icon tw-hidden"><svg class="icon"
    xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><!-- Font Awesome Free 5.15.4 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) --><path d="M173.898 439.404l-166.4-166.4c-9.997-9.997-9.997-26.206 0-36.204l36.203-36.204c9.997-9.998 26.207-9.998 36.204 0L192 312.69 432.095 72.596c9.997-9.997 26.207-9.997 36.204 0l36.203 36.204c9.997 9.997 9.997 26.206 0 36.204l-294.4 294.401c-9.998 9.997-26.207 9.997-36.204-.001z"/></svg></span>
      </button>
        
      <button 
        class="
          tw-select-none 
          tw-mx-2 
          tw-block 
          group-[.is-open]:tw-hidden 
          print:!tw-hidden" 
        disabled
        aria-hidden="true"><svg class="icon"
    xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><!-- Font Awesome Free 5.15.4 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) --><path d="M328 256c0 39.8-32.2 72-72 72s-72-32.2-72-72 32.2-72 72-72 72 32.2 72 72zm104-72c-39.8 0-72 32.2-72 72s32.2 72 72 72 72-32.2 72-72-32.2-72-72-72zm-352 0c-39.8 0-72 32.2-72 72s32.2 72 72 72 72-32.2 72-72-32.2-72-72-72z"/></svg></button>
    </div>
  </div>
  <pre style="counter-reset: codeblock;" class="tw-block tw-m-0 tw-p-0"><code 
    id="codeblock-id-2" 
    class="
      chroma 
      !tw-block 
      tw-p-0
      tw-m-0
      tw-transition-[max-height] 
      tw-duration-500 
      tw-ease-in-out 
      group-[.is-closed]:!tw-max-h-0 
      group-[.is-wrap]:tw-text-wrap
      tw-overflow-y-hidden
      tw-overflow-x-auto
      tw-scrollbar-thin
      "><span class="line"><span class="cl"><span class="nb">Set-PoshPrompt</span> <span class="n">-Theme</span> <span class="n">主题名字</span></span></span></code></pre>
</div>
<p>我们需要配置 PowerShell 的启动脚本，以使主题永久生效。执行以下命令打开脚本文件。若提示文件不存在，则同意创建。</p>
<div class="code-block highlight is-open show-line-numbers  tw-group tw-my-2">
  <div class="
    code-block-title 
    
    tw-flex 
    tw-flex-row 
    tw-justify-between 
    tw-w-full tw-bg-bgColor-secondary
    ">      
    <button 
      class="
        tw-select-none 
        tw-mx-2 
        tw-block
        group-[.is-open]:tw-rotate-90
        tw-transition-[transform] 
        tw-duration-500 
        tw-ease-in-out
        print:!tw-hidden"
      disabled
      aria-hidden="true"><svg class="icon"
    xmlns="http://www.w3.org/2000/svg" viewBox="0 0 320 512"><!-- Font Awesome Free 5.15.4 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) --><path d="M285.476 272.971L91.132 467.314c-9.373 9.373-24.569 9.373-33.941 0l-22.667-22.667c-9.357-9.357-9.375-24.522-.04-33.901L188.505 256 34.484 101.255c-9.335-9.379-9.317-24.544.04-33.901l22.667-22.667c9.373-9.373 24.569-9.373 33.941 0L285.475 239.03c9.373 9.372 9.373 24.568.001 33.941z"/></svg></button>

    <div class="code-block-title-bar tw-w-full">
      <p class="tw-select-none !tw-my-1">powershell</p>
    </div>
    <div class="tw-flex">
      <button 
        class="
          line-number-button
          tw-select-none 
          tw-mx-2 
          tw-hidden 
          group-[.is-open]:tw-block 
          group-[.show-line-numbers]:tw-text-fgColor-link 
          print:!tw-hidden" 
        title="Toggle line numbers"><svg class="icon"
    xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><!-- Font Awesome Free 5.15.4 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) --><path d="M61.77 401l17.5-20.15a19.92 19.92 0 0 0 5.07-14.19v-3.31C84.34 356 80.5 352 73 352H16a8 8 0 0 0-8 8v16a8 8 0 0 0 8 8h22.83a157.41 157.41 0 0 0-11 12.31l-5.61 7c-4 5.07-5.25 10.13-2.8 14.88l1.05 1.93c3 5.76 6.29 7.88 12.25 7.88h4.73c10.33 0 15.94 2.44 15.94 9.09 0 4.72-4.2 8.22-14.36 8.22a41.54 41.54 0 0 1-15.47-3.12c-6.49-3.88-11.74-3.5-15.6 3.12l-5.59 9.31c-3.72 6.13-3.19 11.72 2.63 15.94 7.71 4.69 20.38 9.44 37 9.44 34.16 0 48.5-22.75 48.5-44.12-.03-14.38-9.12-29.76-28.73-34.88zM496 224H176a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16h320a16 16 0 0 0 16-16v-32a16 16 0 0 0-16-16zm0-160H176a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16h320a16 16 0 0 0 16-16V80a16 16 0 0 0-16-16zm0 320H176a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16h320a16 16 0 0 0 16-16v-32a16 16 0 0 0-16-16zM16 160h64a8 8 0 0 0 8-8v-16a8 8 0 0 0-8-8H64V40a8 8 0 0 0-8-8H32a8 8 0 0 0-7.14 4.42l-8 16A8 8 0 0 0 24 64h8v64H16a8 8 0 0 0-8 8v16a8 8 0 0 0 8 8zm-3.91 160H80a8 8 0 0 0 8-8v-16a8 8 0 0 0-8-8H41.32c3.29-10.29 48.34-18.68 48.34-56.44 0-29.06-25-39.56-44.47-39.56-21.36 0-33.8 10-40.46 18.75-4.37 5.59-3 10.84 2.8 15.37l8.58 6.88c5.61 4.56 11 2.47 16.12-2.44a13.44 13.44 0 0 1 9.46-3.84c3.33 0 9.28 1.56 9.28 8.75C51 248.19 0 257.31 0 304.59v4C0 316 5.08 320 12.09 320z"/></svg></button>

      <button 
        class="
          wrap-code-button
          tw-select-none 
          tw-mx-2 
          tw-hidden 
          group-[.is-open]:tw-block 
          group-[.is-wrap]:tw-text-fgColor-link 
          print:!tw-hidden" 
        title="Toggle code wrap"><svg class="icon"
    xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><!-- Font Awesome Free 5.15.4 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) --><path d="M16 132h416c8.837 0 16-7.163 16-16V76c0-8.837-7.163-16-16-16H16C7.163 60 0 67.163 0 76v40c0 8.837 7.163 16 16 16zm0 160h416c8.837 0 16-7.163 16-16v-40c0-8.837-7.163-16-16-16H16c-8.837 0-16 7.163-16 16v40c0 8.837 7.163 16 16 16zm0 160h416c8.837 0 16-7.163 16-16v-40c0-8.837-7.163-16-16-16H16c-8.837 0-16 7.163-16 16v40c0 8.837 7.163 16 16 16z"/></svg></button>
      
      <button 
        class="
          copy-code-button
          tw-select-none
          tw-mx-2 
          tw-hidden
          group-[.is-open]:tw-block
          hover:tw-text-fgColor-link 
          print:!tw-hidden"
        title="Copy code">
          <span class="copy-icon tw-block"><svg class="icon"
    xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><!-- Font Awesome Free 5.15.4 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) --><path d="M433.941 65.941l-51.882-51.882A48 48 0 0 0 348.118 0H176c-26.51 0-48 21.49-48 48v48H48c-26.51 0-48 21.49-48 48v320c0 26.51 21.49 48 48 48h224c26.51 0 48-21.49 48-48v-48h80c26.51 0 48-21.49 48-48V99.882a48 48 0 0 0-14.059-33.941zM266 464H54a6 6 0 0 1-6-6V150a6 6 0 0 1 6-6h74v224c0 26.51 21.49 48 48 48h96v42a6 6 0 0 1-6 6zm128-96H182a6 6 0 0 1-6-6V54a6 6 0 0 1 6-6h106v88c0 13.255 10.745 24 24 24h88v202a6 6 0 0 1-6 6zm6-256h-64V48h9.632c1.591 0 3.117.632 4.243 1.757l48.368 48.368a6 6 0 0 1 1.757 4.243V112z"/></svg></span>
          <span class="check-icon tw-hidden"><svg class="icon"
    xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><!-- Font Awesome Free 5.15.4 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) --><path d="M173.898 439.404l-166.4-166.4c-9.997-9.997-9.997-26.206 0-36.204l36.203-36.204c9.997-9.998 26.207-9.998 36.204 0L192 312.69 432.095 72.596c9.997-9.997 26.207-9.997 36.204 0l36.203 36.204c9.997 9.997 9.997 26.206 0 36.204l-294.4 294.401c-9.998 9.997-26.207 9.997-36.204-.001z"/></svg></span>
      </button>
        
      <button 
        class="
          tw-select-none 
          tw-mx-2 
          tw-block 
          group-[.is-open]:tw-hidden 
          print:!tw-hidden" 
        disabled
        aria-hidden="true"><svg class="icon"
    xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><!-- Font Awesome Free 5.15.4 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) --><path d="M328 256c0 39.8-32.2 72-72 72s-72-32.2-72-72 32.2-72 72-72 72 32.2 72 72zm104-72c-39.8 0-72 32.2-72 72s32.2 72 72 72 72-32.2 72-72-32.2-72-72-72zm-352 0c-39.8 0-72 32.2-72 72s32.2 72 72 72 72-32.2 72-72-32.2-72-72-72z"/></svg></button>
    </div>
  </div>
  <pre style="counter-reset: codeblock;" class="tw-block tw-m-0 tw-p-0"><code 
    id="codeblock-id-3" 
    class="
      chroma 
      !tw-block 
      tw-p-0
      tw-m-0
      tw-transition-[max-height] 
      tw-duration-500 
      tw-ease-in-out 
      group-[.is-closed]:!tw-max-h-0 
      group-[.is-wrap]:tw-text-wrap
      tw-overflow-y-hidden
      tw-overflow-x-auto
      tw-scrollbar-thin
      "><span class="line"><span class="cl"><span class="n">notepad</span> <span class="nv">$Profile</span></span></span></code></pre>
</div>
<p>然后在打开的脚本文件中输入以下命令：</p>
<div class="code-block highlight is-open show-line-numbers  tw-group tw-my-2">
  <div class="
    code-block-title 
    
    tw-flex 
    tw-flex-row 
    tw-justify-between 
    tw-w-full tw-bg-bgColor-secondary
    ">      
    <button 
      class="
        tw-select-none 
        tw-mx-2 
        tw-block
        group-[.is-open]:tw-rotate-90
        tw-transition-[transform] 
        tw-duration-500 
        tw-ease-in-out
        print:!tw-hidden"
      disabled
      aria-hidden="true"><svg class="icon"
    xmlns="http://www.w3.org/2000/svg" viewBox="0 0 320 512"><!-- Font Awesome Free 5.15.4 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) --><path d="M285.476 272.971L91.132 467.314c-9.373 9.373-24.569 9.373-33.941 0l-22.667-22.667c-9.357-9.357-9.375-24.522-.04-33.901L188.505 256 34.484 101.255c-9.335-9.379-9.317-24.544.04-33.901l22.667-22.667c9.373-9.373 24.569-9.373 33.941 0L285.475 239.03c9.373 9.372 9.373 24.568.001 33.941z"/></svg></button>

    <div class="code-block-title-bar tw-w-full">
      <p class="tw-select-none !tw-my-1">powershell</p>
    </div>
    <div class="tw-flex">
      <button 
        class="
          line-number-button
          tw-select-none 
          tw-mx-2 
          tw-hidden 
          group-[.is-open]:tw-block 
          group-[.show-line-numbers]:tw-text-fgColor-link 
          print:!tw-hidden" 
        title="Toggle line numbers"><svg class="icon"
    xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><!-- Font Awesome Free 5.15.4 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) --><path d="M61.77 401l17.5-20.15a19.92 19.92 0 0 0 5.07-14.19v-3.31C84.34 356 80.5 352 73 352H16a8 8 0 0 0-8 8v16a8 8 0 0 0 8 8h22.83a157.41 157.41 0 0 0-11 12.31l-5.61 7c-4 5.07-5.25 10.13-2.8 14.88l1.05 1.93c3 5.76 6.29 7.88 12.25 7.88h4.73c10.33 0 15.94 2.44 15.94 9.09 0 4.72-4.2 8.22-14.36 8.22a41.54 41.54 0 0 1-15.47-3.12c-6.49-3.88-11.74-3.5-15.6 3.12l-5.59 9.31c-3.72 6.13-3.19 11.72 2.63 15.94 7.71 4.69 20.38 9.44 37 9.44 34.16 0 48.5-22.75 48.5-44.12-.03-14.38-9.12-29.76-28.73-34.88zM496 224H176a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16h320a16 16 0 0 0 16-16v-32a16 16 0 0 0-16-16zm0-160H176a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16h320a16 16 0 0 0 16-16V80a16 16 0 0 0-16-16zm0 320H176a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16h320a16 16 0 0 0 16-16v-32a16 16 0 0 0-16-16zM16 160h64a8 8 0 0 0 8-8v-16a8 8 0 0 0-8-8H64V40a8 8 0 0 0-8-8H32a8 8 0 0 0-7.14 4.42l-8 16A8 8 0 0 0 24 64h8v64H16a8 8 0 0 0-8 8v16a8 8 0 0 0 8 8zm-3.91 160H80a8 8 0 0 0 8-8v-16a8 8 0 0 0-8-8H41.32c3.29-10.29 48.34-18.68 48.34-56.44 0-29.06-25-39.56-44.47-39.56-21.36 0-33.8 10-40.46 18.75-4.37 5.59-3 10.84 2.8 15.37l8.58 6.88c5.61 4.56 11 2.47 16.12-2.44a13.44 13.44 0 0 1 9.46-3.84c3.33 0 9.28 1.56 9.28 8.75C51 248.19 0 257.31 0 304.59v4C0 316 5.08 320 12.09 320z"/></svg></button>

      <button 
        class="
          wrap-code-button
          tw-select-none 
          tw-mx-2 
          tw-hidden 
          group-[.is-open]:tw-block 
          group-[.is-wrap]:tw-text-fgColor-link 
          print:!tw-hidden" 
        title="Toggle code wrap"><svg class="icon"
    xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><!-- Font Awesome Free 5.15.4 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) --><path d="M16 132h416c8.837 0 16-7.163 16-16V76c0-8.837-7.163-16-16-16H16C7.163 60 0 67.163 0 76v40c0 8.837 7.163 16 16 16zm0 160h416c8.837 0 16-7.163 16-16v-40c0-8.837-7.163-16-16-16H16c-8.837 0-16 7.163-16 16v40c0 8.837 7.163 16 16 16zm0 160h416c8.837 0 16-7.163 16-16v-40c0-8.837-7.163-16-16-16H16c-8.837 0-16 7.163-16 16v40c0 8.837 7.163 16 16 16z"/></svg></button>
      
      <button 
        class="
          copy-code-button
          tw-select-none
          tw-mx-2 
          tw-hidden
          group-[.is-open]:tw-block
          hover:tw-text-fgColor-link 
          print:!tw-hidden"
        title="Copy code">
          <span class="copy-icon tw-block"><svg class="icon"
    xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><!-- Font Awesome Free 5.15.4 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) --><path d="M433.941 65.941l-51.882-51.882A48 48 0 0 0 348.118 0H176c-26.51 0-48 21.49-48 48v48H48c-26.51 0-48 21.49-48 48v320c0 26.51 21.49 48 48 48h224c26.51 0 48-21.49 48-48v-48h80c26.51 0 48-21.49 48-48V99.882a48 48 0 0 0-14.059-33.941zM266 464H54a6 6 0 0 1-6-6V150a6 6 0 0 1 6-6h74v224c0 26.51 21.49 48 48 48h96v42a6 6 0 0 1-6 6zm128-96H182a6 6 0 0 1-6-6V54a6 6 0 0 1 6-6h106v88c0 13.255 10.745 24 24 24h88v202a6 6 0 0 1-6 6zm6-256h-64V48h9.632c1.591 0 3.117.632 4.243 1.757l48.368 48.368a6 6 0 0 1 1.757 4.243V112z"/></svg></span>
          <span class="check-icon tw-hidden"><svg class="icon"
    xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><!-- Font Awesome Free 5.15.4 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) --><path d="M173.898 439.404l-166.4-166.4c-9.997-9.997-9.997-26.206 0-36.204l36.203-36.204c9.997-9.998 26.207-9.998 36.204 0L192 312.69 432.095 72.596c9.997-9.997 26.207-9.997 36.204 0l36.203 36.204c9.997 9.997 9.997 26.206 0 36.204l-294.4 294.401c-9.998 9.997-26.207 9.997-36.204-.001z"/></svg></span>
      </button>
        
      <button 
        class="
          tw-select-none 
          tw-mx-2 
          tw-block 
          group-[.is-open]:tw-hidden 
          print:!tw-hidden" 
        disabled
        aria-hidden="true"><svg class="icon"
    xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><!-- Font Awesome Free 5.15.4 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) --><path d="M328 256c0 39.8-32.2 72-72 72s-72-32.2-72-72 32.2-72 72-72 72 32.2 72 72zm104-72c-39.8 0-72 32.2-72 72s32.2 72 72 72 72-32.2 72-72-32.2-72-72-72zm-352 0c-39.8 0-72 32.2-72 72s32.2 72 72 72 72-32.2 72-72-32.2-72-72-72z"/></svg></button>
    </div>
  </div>
  <pre style="counter-reset: codeblock;" class="tw-block tw-m-0 tw-p-0"><code 
    id="codeblock-id-4" 
    class="
      chroma 
      !tw-block 
      tw-p-0
      tw-m-0
      tw-transition-[max-height] 
      tw-duration-500 
      tw-ease-in-out 
      group-[.is-closed]:!tw-max-h-0 
      group-[.is-wrap]:tw-text-wrap
      tw-overflow-y-hidden
      tw-overflow-x-auto
      tw-scrollbar-thin
      "><span class="line"><span class="cl"><span class="nb">Import-Module</span> <span class="nb">oh-my</span><span class="n">-posh</span>
</span></span><span class="line"><span class="cl"><span class="nb">Set-PoshPrompt</span> <span class="n">-Theme</span> <span class="n">agnosterplus</span> <span class="c"># 此处将agnosterplus替换为自己选主题名即可</span></span></span></code></pre>
</div>
<div align="center"><img src="https://i.loli.net/2021/08/20/dR6Zeak38JIFb2U.png" alt="20210820015214" width="600" align="center"/></div>
<p>如果从 Microsoft Store 安装的 <code>oh-my-posh</code>，则在以上脚本文件中输入以下命令：</p>
<div class="code-block highlight is-open show-line-numbers  tw-group tw-my-2">
  <div class="
    code-block-title 
    
    tw-flex 
    tw-flex-row 
    tw-justify-between 
    tw-w-full tw-bg-bgColor-secondary
    ">      
    <button 
      class="
        tw-select-none 
        tw-mx-2 
        tw-block
        group-[.is-open]:tw-rotate-90
        tw-transition-[transform] 
        tw-duration-500 
        tw-ease-in-out
        print:!tw-hidden"
      disabled
      aria-hidden="true"><svg class="icon"
    xmlns="http://www.w3.org/2000/svg" viewBox="0 0 320 512"><!-- Font Awesome Free 5.15.4 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) --><path d="M285.476 272.971L91.132 467.314c-9.373 9.373-24.569 9.373-33.941 0l-22.667-22.667c-9.357-9.357-9.375-24.522-.04-33.901L188.505 256 34.484 101.255c-9.335-9.379-9.317-24.544.04-33.901l22.667-22.667c9.373-9.373 24.569-9.373 33.941 0L285.475 239.03c9.373 9.372 9.373 24.568.001 33.941z"/></svg></button>

    <div class="code-block-title-bar tw-w-full">
      <p class="tw-select-none !tw-my-1">powershell</p>
    </div>
    <div class="tw-flex">
      <button 
        class="
          line-number-button
          tw-select-none 
          tw-mx-2 
          tw-hidden 
          group-[.is-open]:tw-block 
          group-[.show-line-numbers]:tw-text-fgColor-link 
          print:!tw-hidden" 
        title="Toggle line numbers"><svg class="icon"
    xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><!-- Font Awesome Free 5.15.4 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) --><path d="M61.77 401l17.5-20.15a19.92 19.92 0 0 0 5.07-14.19v-3.31C84.34 356 80.5 352 73 352H16a8 8 0 0 0-8 8v16a8 8 0 0 0 8 8h22.83a157.41 157.41 0 0 0-11 12.31l-5.61 7c-4 5.07-5.25 10.13-2.8 14.88l1.05 1.93c3 5.76 6.29 7.88 12.25 7.88h4.73c10.33 0 15.94 2.44 15.94 9.09 0 4.72-4.2 8.22-14.36 8.22a41.54 41.54 0 0 1-15.47-3.12c-6.49-3.88-11.74-3.5-15.6 3.12l-5.59 9.31c-3.72 6.13-3.19 11.72 2.63 15.94 7.71 4.69 20.38 9.44 37 9.44 34.16 0 48.5-22.75 48.5-44.12-.03-14.38-9.12-29.76-28.73-34.88zM496 224H176a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16h320a16 16 0 0 0 16-16v-32a16 16 0 0 0-16-16zm0-160H176a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16h320a16 16 0 0 0 16-16V80a16 16 0 0 0-16-16zm0 320H176a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16h320a16 16 0 0 0 16-16v-32a16 16 0 0 0-16-16zM16 160h64a8 8 0 0 0 8-8v-16a8 8 0 0 0-8-8H64V40a8 8 0 0 0-8-8H32a8 8 0 0 0-7.14 4.42l-8 16A8 8 0 0 0 24 64h8v64H16a8 8 0 0 0-8 8v16a8 8 0 0 0 8 8zm-3.91 160H80a8 8 0 0 0 8-8v-16a8 8 0 0 0-8-8H41.32c3.29-10.29 48.34-18.68 48.34-56.44 0-29.06-25-39.56-44.47-39.56-21.36 0-33.8 10-40.46 18.75-4.37 5.59-3 10.84 2.8 15.37l8.58 6.88c5.61 4.56 11 2.47 16.12-2.44a13.44 13.44 0 0 1 9.46-3.84c3.33 0 9.28 1.56 9.28 8.75C51 248.19 0 257.31 0 304.59v4C0 316 5.08 320 12.09 320z"/></svg></button>

      <button 
        class="
          wrap-code-button
          tw-select-none 
          tw-mx-2 
          tw-hidden 
          group-[.is-open]:tw-block 
          group-[.is-wrap]:tw-text-fgColor-link 
          print:!tw-hidden" 
        title="Toggle code wrap"><svg class="icon"
    xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><!-- Font Awesome Free 5.15.4 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) --><path d="M16 132h416c8.837 0 16-7.163 16-16V76c0-8.837-7.163-16-16-16H16C7.163 60 0 67.163 0 76v40c0 8.837 7.163 16 16 16zm0 160h416c8.837 0 16-7.163 16-16v-40c0-8.837-7.163-16-16-16H16c-8.837 0-16 7.163-16 16v40c0 8.837 7.163 16 16 16zm0 160h416c8.837 0 16-7.163 16-16v-40c0-8.837-7.163-16-16-16H16c-8.837 0-16 7.163-16 16v40c0 8.837 7.163 16 16 16z"/></svg></button>
      
      <button 
        class="
          copy-code-button
          tw-select-none
          tw-mx-2 
          tw-hidden
          group-[.is-open]:tw-block
          hover:tw-text-fgColor-link 
          print:!tw-hidden"
        title="Copy code">
          <span class="copy-icon tw-block"><svg class="icon"
    xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><!-- Font Awesome Free 5.15.4 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) --><path d="M433.941 65.941l-51.882-51.882A48 48 0 0 0 348.118 0H176c-26.51 0-48 21.49-48 48v48H48c-26.51 0-48 21.49-48 48v320c0 26.51 21.49 48 48 48h224c26.51 0 48-21.49 48-48v-48h80c26.51 0 48-21.49 48-48V99.882a48 48 0 0 0-14.059-33.941zM266 464H54a6 6 0 0 1-6-6V150a6 6 0 0 1 6-6h74v224c0 26.51 21.49 48 48 48h96v42a6 6 0 0 1-6 6zm128-96H182a6 6 0 0 1-6-6V54a6 6 0 0 1 6-6h106v88c0 13.255 10.745 24 24 24h88v202a6 6 0 0 1-6 6zm6-256h-64V48h9.632c1.591 0 3.117.632 4.243 1.757l48.368 48.368a6 6 0 0 1 1.757 4.243V112z"/></svg></span>
          <span class="check-icon tw-hidden"><svg class="icon"
    xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><!-- Font Awesome Free 5.15.4 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) --><path d="M173.898 439.404l-166.4-166.4c-9.997-9.997-9.997-26.206 0-36.204l36.203-36.204c9.997-9.998 26.207-9.998 36.204 0L192 312.69 432.095 72.596c9.997-9.997 26.207-9.997 36.204 0l36.203 36.204c9.997 9.997 9.997 26.206 0 36.204l-294.4 294.401c-9.998 9.997-26.207 9.997-36.204-.001z"/></svg></span>
      </button>
        
      <button 
        class="
          tw-select-none 
          tw-mx-2 
          tw-block 
          group-[.is-open]:tw-hidden 
          print:!tw-hidden" 
        disabled
        aria-hidden="true"><svg class="icon"
    xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><!-- Font Awesome Free 5.15.4 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) --><path d="M328 256c0 39.8-32.2 72-72 72s-72-32.2-72-72 32.2-72 72-72 72 32.2 72 72zm104-72c-39.8 0-72 32.2-72 72s32.2 72 72 72 72-32.2 72-72-32.2-72-72-72zm-352 0c-39.8 0-72 32.2-72 72s32.2 72 72 72 72-32.2 72-72-32.2-72-72-72z"/></svg></button>
    </div>
  </div>
  <pre style="counter-reset: codeblock;" class="tw-block tw-m-0 tw-p-0"><code 
    id="codeblock-id-5" 
    class="
      chroma 
      !tw-block 
      tw-p-0
      tw-m-0
      tw-transition-[max-height] 
      tw-duration-500 
      tw-ease-in-out 
      group-[.is-closed]:!tw-max-h-0 
      group-[.is-wrap]:tw-text-wrap
      tw-overflow-y-hidden
      tw-overflow-x-auto
      tw-scrollbar-thin
      "><span class="line"><span class="cl"><span class="nb">oh-my</span><span class="n">-posh</span> <span class="n">init</span> <span class="n">pwsh</span> <span class="p">-</span><span class="n">-config</span> <span class="s2">&#34;</span><span class="nv">$env:POSH_THEMES_PATH</span><span class="s2">\agnosterplus.omp.json&#34;</span> <span class="p">|</span> <span class="nb">Invoke-Expression</span> 
</span></span><span class="line"><span class="cl"><span class="c"># 此处将agnosterplus替换为自己选的主题即可</span></span></span></code></pre>
</div>
<p>之后重启即可看到效果。</p>
<h4 id="设置字体" class="headerLink">
    <a href="#%e8%ae%be%e7%bd%ae%e5%ad%97%e4%bd%93" class="header-mark"></a>设置字体</h4><p>为了对主题所需的图标符号提供支持，需要 Nerd Fonts 类字体，可以到字体集合主页<a href="https://www.nerdfonts.com/font-downloads" target="_blank" rel="noopener noreferrer">Nerd Fonts</a> 挑选喜欢的字体，可以预览字体效果。选好后直接下载字体文件即可。</p>
<div align="center"><img src="https://i.loli.net/2021/08/20/lsOcpUwBy4xd2bL.png" alt="20210820011124" width="600" align="center"/></div>
<p>经过一番查看，我最终凭感觉选择了<a href="https://www.programmingfonts.org/#go-mono" target="_blank" rel="noopener noreferrer">Go Mono</a>。</p>
<p>将下载的压缩包直接解压缩后，是一套字体文件，由于不需要其他用途，此处只安装正体的字体。选择不带<code>Bold</code>（加粗）不带<code>Italic</code>（斜体）的<code>Windows Compatible</code>字体文件，直接双击安装。</p>
<div align="center"><img src="https://i.loli.net/2021/08/20/gBME3FHYmD6aPky.png" alt="20210820011818" width="600" align="center"/></div>
<p>弹出的对话窗口，展示了字体样式，直接点击左上角<code>安装</code>即可。</p>
<div align="center"><img src="https://i.loli.net/2021/08/20/ZAouMcT3qRtKXn8.png" alt="20210820011909" width="600" align="center"/></div>
<p>字体已经安装好，接下来在 Terminal 下按<code>Ctrl + ,</code>打开设置，从左侧<code>配置文件</code>中选择到自己新建的PowerShell，我的是 PowerShell 7 ，然后右侧选择<code>外观</code>选项卡，找到<code>字体</code>下拉菜单，选择自己所选的字体名字即可，我的为 <code>GoMono NF</code>。</p>
<div align="center"><img src="https://i.loli.net/2021/08/20/K8gvdt7i9XWmbfz.png" alt="20210820013609" width="600" align="center"/></div>
<p>字体名可以从系统<code>字体设置</code>查看到，<code>开始</code>-&gt;<code>设置</code>-&gt;搜索<code>字体设置</code>-&gt;搜索字体关键字&rsquo;GoMono&rsquo;。可以看到我的字体名为<code>GoMono NF</code>。记住这个字体名，之后 VS Code 的终端 PowerShell 配置中会再次用到。</p>
<div align="center"><img src="https://i.loli.net/2021/08/20/WPJMpFvmrCzB6G1.png" alt="20210820013917" width="600" align="center"/></div>
<h4 id="设置背景图" class="headerLink">
    <a href="#%e8%ae%be%e7%bd%ae%e8%83%8c%e6%99%af%e5%9b%be" class="header-mark"></a>设置背景图</h4><p>只需打开 Terminal 的设置，从左侧<code>配置文件</code>中选择到自己新建的PowerShell，然后右侧选择<code>外观</code>选项卡，找到<code>背景图像</code>设置项，<code>浏览</code>选择图片。选好图片后，下面会多出一些针对背景图的设置，包括模糊、透明、位置等，可以自行调整。</p>
<div align="center"><img src="https://i.loli.net/2021/08/20/ycigkn2EKq3uSW6.png" alt="20210820015908" width="600" align="center"/></div>
<h3 id="vs-code-集成-powershell" class="headerLink">
    <a href="#vs-code-%e9%9b%86%e6%88%90-powershell" class="header-mark"></a>VS Code 集成 PowerShell</h3><p>VS Code 内按快捷键 <code>Ctrl + Shift + `</code>，则在编辑窗口下面会打开一个（默认CMD）终端窗口。VS Code中已经自动集成了 CMD 和 Windows PowerShell。但我需要：1. 将新版的 PowerShell Preview 集成进来；2. 将其设置为默认打开；3. 更改终端字体，以提供主题包支持。</p>
<p>首先<code>Ctrl + ,</code>打开设置，然后搜索<code>Terminal</code>，找到<code>Terminal &gt; Integrated &gt; Profiles: Windows</code>的项，点击下面的<code>在settings.json中编辑</code>。</p>
<div align="center"><img src="https://i.loli.net/2021/08/20/vsoxaMFq5CWVApl.png" alt="20210820202923" width="600" align="center"/></div>
<p>之后在打开的<code>settings.json</code>文件下，在<code>terminal.integrated.profiles.windows</code>项内按照以下红色框中代码的格式添加自己的 PowerShell 条目，其中的<code>PowerShell 7 pre</code>替换为自拟名字即可，<code>path</code>项内的路径替换为自己的 PowerShell 安装路径。然后<strong>保存</strong>并关闭文件。</p>
<div align="center"><img src="https://i.loli.net/2021/08/20/tEZuRs32vFoNljz.png" alt="20210820202519" width="600" align="center"/></div>
<blockquote>
  <p>如果是从Microsoft Store安装的 PowserShell，上图中的 <code>path</code> 字段为：<code>&quot;C:\Users\用户名\AppData\Local\Microsoft\WindowsApps\Microsoft.PowerShellPreview_8wekyb3d8bbwe\pwsh.exe&quot;</code></p>
</blockquote><p>通过以上操作，我们已经为终端窗口添加了新的 PowerShell。接下来将其设置为默认打开。</p>
<p>仍然<code>Ctrl + ,</code>打开设置，搜索<code>Terminal</code>，找到<code>Terminal &gt; Integrated &gt; Default Profile: Windows</code>项，下拉选项中选择我们上一步添加的 PowerShell 的名字<code>PowerShell 7 pre</code>。</p>
<div align="center"><img src="https://i.loli.net/2021/08/20/JMjS9P6tqgGo15E.png" alt="20210820202020" width="600" align="center"/></div>
<p>在设置页，搜索<code>Terminal Font</code>，找到<code>Terminal &gt; Integrated &gt; Font Family</code>项，将其值设置为我们前面安装的字体文件名 <code>GoMono NF</code>，由于我选的这款字体本身字号挺大，所以我还将字号改为了 <code>12</code>。</p>
<div align="center"><img src="https://i.loli.net/2021/08/20/V4LHzeAhtSMnEFc.png" alt="20210820200321" width="600" align="center"/></div>
<p>经过以上配置，最终的效果如下图。</p>
<div align="center"><img src="https://i.loli.net/2021/08/20/a81uBoP3XWL2J9m.png" alt="20210820201644" width="600" align="center"/></div>
<h3 id="参考" class="headerLink">
    <a href="#%e5%8f%82%e8%80%83" class="header-mark"></a>参考</h3><ul>
<li><a href="https://www.edgeless.top/PowerShell%E7%BE%8E%E5%8C%96/" target="_blank" rel="noopener noreferrer">PowerShell 美化 - j3rry</a></li>
<li><a href="https://www.nerdfonts.com/font-downloads" target="_blank" rel="noopener noreferrer">Nerd Fonts</a></li>
<li><a href="https://ohmyposh.dev/docs/pwsh" target="_blank" rel="noopener noreferrer">oh-my-push 文档</a></li>
<li><a href="https://docs.microsoft.com/en-us/powershell/scripting/dev-cross-plat/vscode/using-vscode?view=powershell-7.2#adding-your-own-powershell-paths-to-the-session-menu" target="_blank" rel="noopener noreferrer">Using Visual Studio Code for PowerShell Development - Microsoft</a></li>
<li><a href="https://code.visualstudio.com/docs/editor/integrated-terminal#_configuring-profiles" target="_blank" rel="noopener noreferrer">VS Code Integrated Terminal</a></li>
<li><a href="https://www.cnblogs.com/taylorshi/p/16482694.html" target="_blank" rel="noopener noreferrer">再谈 Windows Terminal (终端) 主题和字体美化，Oh-My-Posh、Terminal-Icons、Posh-git</a></li>
<li><a href="https://www.cnblogs.com/xiaorang/articles/windows_terminal_oh_my_posh.html" target="_blank" rel="noopener noreferrer">Windows Terminal 美化 (oh-my-posh)</a></li>
</ul>]]></description></item></channel></rss>