Skip to content

如何升级

¥How to upgrade

升级 Insiders 时,您应该始终检查 MkDocs 的 Material 版本,该版本构成版本限定符的第一部分,例如,Insiders 4.x.x目前基于9.x.x

¥When upgrading Insiders, you should always check the version of Material for MkDocs which makes up the first part of the version qualifier, e.g., Insiders 4.x.x is currently based on 9.x.x:

9.x.x-insiders-4.x.x

如果主要版本增加,最好查阅升级指南并按照步骤确保您的配置是最新的并且已完成所有必要的更改。

¥If the major version increased, it's a good idea to consult the upgrade guide and go through the steps to ensure your configuration is up to date and all necessary changes have been made.

根据您的安装方式和要升级的内容,您需要运行不同的命令:

¥Depending on how you installed and what you want to upgrade to you need to run different commands:

如果您通过pip安装了 Insiders 并且想要升级到特定版本,请从标签列表中选择标签并替换下面给出的命令的 URL 末尾的标签:

¥If you installed Insiders via pip and you want to upgrade to a specific release, pick the tag from the list of tags and replace the tag at the end of the URL of the command given below:

pip install --upgrade git+https://${GH_TOKEN}@github.com/squidfunk/mkdocs-material-insiders.git@9.4.2-insiders-4.42.0

如果您通过pip安装了 Insiders 并想要升级到最新的开发版本,请运行:

¥If you installed Insiders via pip and want to upgrade to the latest development version, run:

pip install --upgrade --force-reinstall git+https://${GH_TOKEN}@github.com/squidfunk/mkdocs-material-insiders.git

--force-reinstall选项用于确保pip确实安装了最新的开发版本,而不是根据版本号决定不执行任何操作。```

¥The --force-reinstall option serves to make sure pip does, in fact, install the latest development version, instead of deciding that nothing is to be done based on the version numbers. ```

如果你通过git安装了 Insiders,那么首先需要将要安装的版本检出到你的工作区。完成后,你可以运行pip来安装该版本。

¥If you installed Insiders via git, you will first need to check out the version you want to install into your workspace. After this is done, you can run pip to install that version.

首先,通过运行git pull确保您的本地克隆与上游存储库保持同步。

¥First, make sure that your local clone is up-to-date with the upstream repository by running git pull.

你可以使用git tag --sort -refname查找标签,也可以查阅标签列表。然后,通过替换以下命令中给出的标签(两次)并从你的工作区1运行它来检出你想要使用的标签:

¥You can look up the tags using git tag --sort -refname or you can consult the list of tags. Then, checkout the tag you want to use by replacing the one given in the command below (twice)and running it from your workspace1:

cd mkdocs-material 
git checkout --detach tags/9.4.2-insiders-4.42.0 

现在,切换回 Git 存储库所在的父目录并运行pip

¥Now, change back to the parent directory in which your Git repository lives and run pip:

cd .. 
pip install -e mkdocs-material

  1. --detach参数的作用是告诉git你可以让你的工作区处于分离状态,在这里这是完全没问题的。↩