<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>CP Editor – 安装</title><link>/zh/docs/installation/</link><description>Recent content in 安装 on CP Editor</description><generator>Hugo -- gohugo.io</generator><language>zh</language><atom:link href="/zh/docs/installation/index.xml" rel="self" type="application/rss+xml"/><item><title>Docs: 在 Releases 中下载</title><link>/zh/docs/installation/download-from-releases/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>/zh/docs/installation/download-from-releases/</guid><description>
&lt;p>你需要在
&lt;a href="https://github.com/cpeditor/cpeditor/releases" target="_blank" >Releases&lt;/a>
页面找到你需要的版本，然后根据你的操作系统选择相应的文件并下载安装。&lt;/p>
&lt;p>如果你访问 GitHub 的速度较慢，你还可以尝试
&lt;a href="https://gitee.com/ouuan/cpeditor/releases" target="_blank" >Gitee 镜像&lt;/a>
或者
&lt;a href="https://hub.fastgit.xyz/cpeditor/cpeditor/releases" target="_blank" >FastGit 镜像&lt;/a>
。&lt;/p>
&lt;h3 id="windows">Windows&lt;/h3>
&lt;h4 id="使用安装包安装">使用安装包安装&lt;/h4>
&lt;p>使用安装包在你的电脑上进行安装。配置文件将会存储在你的系统的配置目录下，CP Editor 将会出现在你的系统的已安装程序列表中。&lt;/p>
&lt;p>下载 &lt;code>setup.exe&lt;/code> 以进行安装。&lt;/p>
&lt;h4 id="便携式版本">便携式版本&lt;/h4>
&lt;p>使用便携式版本，无需安装即可使用 CP Editor。这意味着你可以将 CP Editor 存储在 U 盘等可移动介质中。&lt;/p>
&lt;p>配置文件将存储在可执行文件所在的文件夹，CP Editor 将不会出现在你的系统的已安装程序列表中。&lt;/p>
&lt;p>下载 &lt;code>portable.zip&lt;/code>，将其解压到任意一个你想要存放的位置。&lt;/p>
&lt;h3 id="绝大部分-linux-发行版">绝大部分 Linux 发行版&lt;/h3>
&lt;p>下载 &lt;code>AppImage&lt;/code>，执行 &lt;code>chmod +x &amp;lt;AppImagePath&amp;gt;&lt;/code> 给其添加执行权限，随后运行该文件。&lt;/p>
&lt;h3 id="debian-系-linux-发行版">Debian 系 Linux 发行版&lt;/h3>
&lt;p>如果你使用的是 Debian 系的 Linux 发行版（Ubuntu，Linux Mint 等），可以下载 &lt;code>.deb&lt;/code> 包，并在终端中执行如下命令：&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-sh" data-lang="sh">&lt;span style="display:flex;">&lt;span>sudo apt install &amp;lt;path to .deb package&amp;gt;
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>接下来输入密码，确认安装。你也可以使用 &lt;code>Gdebi&lt;/code> 等图形化工具安装 &lt;code>deb&lt;/code> 包，要求系统版本不低于 Debian 10 Buster，Ubuntu 18.04 Bionic Beaver，Linux Mint 19 Tara 或其他基于前述发行版的系统的相应版本。&lt;/p>
&lt;h3 id="macos">macOS&lt;/h3>
&lt;p>下载 &lt;code>.dmg&lt;/code> 文件然后安装。如果出现“未识别的开发者”等提示消息，请依然允许 CP Editor 运行。可以在 &lt;code>System Preferences -&amp;gt; Security &amp;amp; Privacy -&amp;gt; General&lt;/code> 中将 CP Editor 添加到白名单里。&lt;/p></description></item><item><title>Docs: 使用包管理器</title><link>/zh/docs/installation/use-package-managers/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>/zh/docs/installation/use-package-managers/</guid><description>
&lt;h3 id="打包情况">打包情况&lt;/h3>
&lt;p>
&lt;a href="https://repology.org/project/cpeditor/versions" target="_blank" >&lt;img src="https://repology.org/badge/vertical-allrepos/cpeditor.svg" alt="Packaging status">&lt;/a>
&lt;/p>
&lt;p>其中有的包是官方维护的，而大多数的包是由社区维护的。&lt;/p>
&lt;p>然而，目前很多软件包仓库都没有包含 CP Editor。如果需要帮助，软件包维护者可以联系我们。例如，我们可以在我们的 CI/CD 工作流中加入一些脚本。&lt;/p>
&lt;p>下面是一些安装软件包的指导。&lt;/p>
&lt;h3 id="snapcraft">Snapcraft&lt;/h3>
&lt;p>你可以使用
&lt;a href="https://snapcraft.io" target="_blank" >Snapcraft&lt;/a>
来安装
&lt;a href="https://snapcraft.io/cpeditor" target="_blank" >cpeditor&lt;/a>
，它在大多数 Linux 发行版上都可用。&lt;/p>
&lt;p>有两个 channel 可供选择：&lt;code>latest/stable&lt;/code> 和 &lt;code>latest/edge&lt;/code>。&lt;/p>
&lt;p>由于技术原因，它以 classic confinement 发布，所以你需要 &lt;code>--classic&lt;/code> 选项来安装它。&lt;/p>
&lt;p>安装最新的稳定版本：&lt;code>sudo snap install cpeditor --classic&lt;/code>&lt;/p>
&lt;p>安装最新的测试（alpha）版本： &lt;code>sudo snap install cpeditor --classic --channel=latest/edge&lt;/code>&lt;/p>
&lt;h3 id="aur">AUR&lt;/h3>
&lt;p>如果你使用的是
&lt;a href="https://wiki.archlinux.org/title/Arch_Linux_%28%e7%ae%80%e4%bd%93%e4%b8%ad%e6%96%87%29" target="_blank" >Arch Linux&lt;/a>
，你可以从
&lt;a href="https://wiki.archlinux.org/title/Arch_User_Repository_%28%e7%ae%80%e4%bd%93%e4%b8%ad%e6%96%87%29" target="_blank" >AUR&lt;/a>
安装 CP Editor。AUR 通常情况下也在 Manjaro 等基于 Arch 的发行版可用，但偶尔会因为主仓库不同等原因而出错。&lt;/p>
&lt;p>CP Editor 在 AUR 上有两个包：稳定版
&lt;a href="https://aur.archlinux.org/packages/cpeditor/" target="_blank" >cpeditor&lt;/a>
和 alpha 版
&lt;a href="https://aur.archlinux.org/packages/cpeditor-git/" target="_blank" >cpeditor-git&lt;/a>
。&lt;/p>
&lt;p>如果你对 AUR 不熟悉，你可以安装
&lt;a href="https://github.com/Morganamilo/paru" target="_blank" >paru&lt;/a>
并使用 &lt;code>paru -S cpeditor&lt;/code> 来安装。你也可以阅读关于
&lt;a href="https://wiki.archlinux.org/title/Arch_User_Repository_%28%e7%ae%80%e4%bd%93%e4%b8%ad%e6%96%87%29#%e5%ae%89%e8%a3%85%e8%bd%af%e4%bb%b6%e5%8c%85" target="_blank" >手动安装 AUR 包&lt;/a>
或者
&lt;a href="https://wiki.archlinux.org/title/AUR_helpers_%28%e7%ae%80%e4%bd%93%e4%b8%ad%e6%96%87%29" target="_blank" >AUR 工具&lt;/a>
的 wiki。&lt;/p>
&lt;p>安装完成后，你就可以在终端中运行 &lt;code>cpeditor&lt;/code> 或在开始菜单中运行 CP Editor 了。&lt;/p></description></item><item><title>Docs: 从源代码构建</title><link>/zh/docs/installation/build-from-source/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>/zh/docs/installation/build-from-source/</guid><description>
&lt;h3 id="准备工作">准备工作&lt;/h3>
&lt;ol>
&lt;li>
&lt;p>克隆源代码仓库以及子组件：&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-sh" data-lang="sh">&lt;span style="display:flex;">&lt;span>git clone --recurse-submodules https://github.com/cpeditor/cpeditor.git
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8f5902;font-style:italic"># 或者分成两条命令&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8f5902;font-style:italic"># git clone https://github.com/cpeditor/cpeditor.git&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8f5902;font-style:italic"># git submodule update --init --recursive&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#204a87">cd&lt;/span> cpeditor
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;/li>
&lt;li>
&lt;p>安装
&lt;a href="https://www.qt.io/download" target="_blank" >Qt&lt;/a>
（5.15）,
&lt;a href="https://cmake.org/download/" target="_blank" >CMake&lt;/a>
（3.12 或更高版本）以及
&lt;a href="https://www.python.org/downloads/" target="_blank" >Python3&lt;/a>
。&lt;/p>
&lt;ul>
&lt;li>在一些 Linux 发行版和 macOS 系统上，你可以直接使用包管理器安装 Qt。例如，在 Arch Linux 上可以使用 &lt;code>sudo pacman -S qt5-base&lt;/code>，在 macOS 上可以使用 &lt;code>brew install qt@5&lt;/code>。&lt;/li>
&lt;li>你还可以使用
&lt;a href="https://github.com/miurahr/aqtinstall" target="_blank" >aqtinstall&lt;/a>
来下载并安装。&lt;/li>
&lt;/ul>
&lt;/li>
&lt;li>
&lt;p>如果 CMake 提示找不到 Qt 路径，你应该设置环境变量：&lt;code>CMAKE_PREFIX_PATH=%QtPath%/%QtVersion%/%Compiler%/lib/cmake&lt;/code>。例如，在 macOS 上，你可以运行 &lt;code>export CMAKE_PREFIX_PATH=&amp;quot;/usr/local/Cellar/qt/5.15.2&amp;quot;&lt;/code>。&lt;/p>
&lt;/li>
&lt;li>
&lt;p>安装
&lt;a href="https://github.com/KDE/extra-cmake-modules" target="_blank" >Extra CMake Modules&lt;/a>
和
&lt;a href="https://github.com/KDE/syntax-highlighting" target="_blank" >KDE (kf5) Syntax Highlighting&lt;/a>
。它们&lt;strong>不再&lt;/strong>作为子模块捆绑，必须在构建前安装到系统中。&lt;/p>
&lt;ul>
&lt;li>
&lt;p>在一些 Linux 发行版和 macOS 系统上，你可以直接使用包管理器安装它们。例如，在 Arch Linux 上可以使用 &lt;code>sudo pacman -S syntax-highlighting5&lt;/code>，在 macOS 上可以使用
&lt;a href="https://github.com/KDE/homebrew-kde" target="_blank" >Homebrew KDE&lt;/a>
然后 &lt;code>brew install kde-mac/kde/kf5-syntax-highlighting&lt;/code>。&lt;/p>
&lt;/li>
&lt;li>
&lt;p>否则，你需要手动克隆并构建安装：&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-sh" data-lang="sh">&lt;span style="display:flex;">&lt;span>git clone --branch kf5 https://github.com/KDE/extra-cmake-modules.git
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#204a87">cd&lt;/span> extra-cmake-modules
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>cmake -B build -S . -DBUILD_HTML_DOCS&lt;span style="color:#ce5c00;font-weight:bold">=&lt;/span>OFF -DBUILD_MAN_DOCS&lt;span style="color:#ce5c00;font-weight:bold">=&lt;/span>OFF -DBUILD_QTHELP_DOCS&lt;span style="color:#ce5c00;font-weight:bold">=&lt;/span>OFF -DBUILD_TESTING&lt;span style="color:#ce5c00;font-weight:bold">=&lt;/span>OFF
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>cmake --build build --config Release --target install &lt;span style="color:#8f5902;font-style:italic"># 可能需要 sudo&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#204a87">cd&lt;/span> ..
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>git clone --branch kf5 https://github.com/KDE/syntax-highlighting.git
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#204a87">cd&lt;/span> syntax-highlighting
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>cmake -B build -S . -DBUILD_HTML_DOCS&lt;span style="color:#ce5c00;font-weight:bold">=&lt;/span>OFF -DBUILD_MAN_DOCS&lt;span style="color:#ce5c00;font-weight:bold">=&lt;/span>OFF -DBUILD_QTHELP_DOCS&lt;span style="color:#ce5c00;font-weight:bold">=&lt;/span>OFF -DBUILD_TESTING&lt;span style="color:#ce5c00;font-weight:bold">=&lt;/span>OFF
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>cmake --build build --config Release --target install &lt;span style="color:#8f5902;font-style:italic"># 可能需要 sudo&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#204a87">cd&lt;/span> ..
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;/li>
&lt;/ul>
&lt;/li>
&lt;/ol>
&lt;h3 id="构建">构建&lt;/h3>
&lt;ul>
&lt;li>
&lt;p>Linux/macOS:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-sh" data-lang="sh">&lt;span style="display:flex;">&lt;span>cmake -S . -B build -DCMAKE_BUILD_TYPE&lt;span style="color:#ce5c00;font-weight:bold">=&lt;/span>Release
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>cmake --build build
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;/li>
&lt;li>
&lt;p>Windows:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-bat" data-lang="bat">&lt;span style="display:flex;">&lt;span>cmake -S . -B build
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>cmake --build build --config Release
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;/li>
&lt;/ul>
&lt;p>在 Linux 上，你会得到 &lt;code>build/cpeditor&lt;/code>。&lt;/p>
&lt;p>在 macOS 上，你会得到 &lt;code>build/cpeditor.app&lt;/code>。&lt;/p>
&lt;p>在 Windows 上，你会得到 &lt;code>build/cpeditor.exe&lt;/code> 或 &lt;code>build/Release/cpeditor.exe&lt;/code>。如果打开时提示 DLL 缺失，你可以将 &lt;code>%QtPath%\%QtVersion%\%Compiler%\bin&lt;/code>（例如：&lt;code>D:\Qt\5.15.2\msvc2019_64\bin&lt;/code>）加入 PATH 环境变量。&lt;/p></description></item><item><title>Docs: 使用 Artifacts</title><link>/zh/docs/installation/use-artifacts/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>/zh/docs/installation/use-artifacts/</guid><description>
&lt;p>如果你想要使用最新版本（比 beta 还要新），但是不想从源代码构建，你可以从
&lt;a href="https://github.com/cpeditor/cpeditor/actions" target="_blank" >GitHub Actions&lt;/a>
下载 Artifacts。&lt;/p>
&lt;p>然而，我们不建议你使用 Artifacts，因为它们比 beta 版本更加不稳定，可能正在开发中。在使用 Artifacts 之前，你应该阅读 commit 日志甚至源代码。&lt;/p>
&lt;p>为了在 Windows/macOS 上运行它，你应该首先从
&lt;a href="https://github.com/cpeditor/cpeditor/releases" target="_blank" >Releases&lt;/a>
安装（通常任何版本都可以，除非出现了 DLL 丢失等问题）。在 Windows 上，将安装文件夹中的 &lt;code>cpeditor.exe&lt;/code> 替换为 Artifact 版本的。在 macOS 上，运行 &lt;code>cp path/to/Artifact cpeditor.app/Contents/MacOs&lt;/code>，其中 &lt;code>cpeditor.app&lt;/code> 是你的计算机上已安装的那个。&lt;/p>
&lt;p>为了在 Ubuntu 18.04 上运行它，你需要安装 Qt。其他 Linux 发行版可能不支持在 Ubuntu 18.04 上编译的二进制文件。&lt;/p></description></item></channel></rss>