无法 运行 mkdocs - 同名主题
Unable To run mkdocs - theme with the same name
我安装了一个主题,安装后,当我从命令行 运行 和 mkdocs 命令时,出现以下错误:
Traceback (most recent call last):
File "/usr/local/bin/mkdocs", line 5, in <module>
from mkdocs.__main__ import cli
File "/usr/local/lib/python2.7/site-packages/mkdocs/__main__.py", line 78, in <module>
theme_choices = utils.get_theme_names()
File "/usr/local/lib/python2.7/site-packages/mkdocs/utils/__init__.py", line 413, in get_theme_names
return get_themes().keys()
File "/usr/local/lib/python2.7/site-packages/mkdocs/utils/__init__.py", line 397, in get_themes
"with the same name".format(theme.name, theme.dist.key))
mkdocs.exceptions.ConfigurationError: The theme readthedocs is a builtin theme but -kdocs provides a theme with the same name
我 运行宁 mac 与:
Python:2.7.15
画中画:20.0.2
如有任何关于如何解决此错误的建议,我们将不胜感激。
最后一行的错误信息解释了这个问题:
mkdocs.exceptions.ConfigurationError: The theme readthedocs is a builtin theme but -kdocs provides a theme with the same name
MkDocs 包含一个名为 readthedocs
的内置主题。并保留内置主题名称。但是,MkDocs 检测到另一个包已将具有相同保留名称的主题注册到 mkdocs.themes
组。显然,该包名为 -kdocs
,这很奇怪,因为 python 包通常不会以连字符 (-
).
开头
无论如何,解决方法是删除带有非法主题名称的包。如果您最近安装了任何第三方主题,请尝试使用命令 pip uninstall packagename
一个一个地卸载它们,直到错误不再发生,其中 packagename
是要卸载的包的名称。对于所有已安装软件包的列表,您可以使用 pip freeze
.
Waylan 提供的信息是正确的,应该删除 -kdocs
包。这里有一些额外的信息。
mkdocs.exceptions.ConfigurationError: The theme readthedocs is a builtin theme but -kdocs provides a theme with the same name
如果你 运行 $ pip list
你可能会看到类似下面的内容。 mkdocs
是一个定期安装的包,而 -kdocs
是一个因删除失败而重命名的包。删除 -kdocs
.
是安全的
Package Version
------------------------------ ----------
-kdocs 1.1.2
mkdocs 1.1.2
但是,如果你运行pip uninstall -kdocs
或pip uninstall "-kdocs"
,你可能会得到以下错误:
$ pip uninstall "-kdocs"
Usage:
pip uninstall [options] <package> ...
pip uninstall [options] -r <requirements file> ...
no such option: -k
您可以直接从文件系统中删除包,而不是使用 pip uninstall
。
如果您列出 site-packages
目录,您可能会看到一个如下命名的子目录。请注意,这以波浪号 ~
而不是连字符 -
.
开头
~kdocs-1.1.2.dist-info
所以使用:
$ cd /path/to/site-packages
$ ls
$ rm -rf ~kdocs-1.1.2.dist-info
我安装了一个主题,安装后,当我从命令行 运行 和 mkdocs 命令时,出现以下错误:
Traceback (most recent call last):
File "/usr/local/bin/mkdocs", line 5, in <module>
from mkdocs.__main__ import cli
File "/usr/local/lib/python2.7/site-packages/mkdocs/__main__.py", line 78, in <module>
theme_choices = utils.get_theme_names()
File "/usr/local/lib/python2.7/site-packages/mkdocs/utils/__init__.py", line 413, in get_theme_names
return get_themes().keys()
File "/usr/local/lib/python2.7/site-packages/mkdocs/utils/__init__.py", line 397, in get_themes
"with the same name".format(theme.name, theme.dist.key))
mkdocs.exceptions.ConfigurationError: The theme readthedocs is a builtin theme but -kdocs provides a theme with the same name
我 运行宁 mac 与: Python:2.7.15 画中画:20.0.2
如有任何关于如何解决此错误的建议,我们将不胜感激。
最后一行的错误信息解释了这个问题:
mkdocs.exceptions.ConfigurationError: The theme readthedocs is a builtin theme but -kdocs provides a theme with the same name
MkDocs 包含一个名为 readthedocs
的内置主题。并保留内置主题名称。但是,MkDocs 检测到另一个包已将具有相同保留名称的主题注册到 mkdocs.themes
组。显然,该包名为 -kdocs
,这很奇怪,因为 python 包通常不会以连字符 (-
).
无论如何,解决方法是删除带有非法主题名称的包。如果您最近安装了任何第三方主题,请尝试使用命令 pip uninstall packagename
一个一个地卸载它们,直到错误不再发生,其中 packagename
是要卸载的包的名称。对于所有已安装软件包的列表,您可以使用 pip freeze
.
Waylan 提供的信息是正确的,应该删除 -kdocs
包。这里有一些额外的信息。
mkdocs.exceptions.ConfigurationError: The theme readthedocs is a builtin theme but -kdocs provides a theme with the same name
如果你 运行 $ pip list
你可能会看到类似下面的内容。 mkdocs
是一个定期安装的包,而 -kdocs
是一个因删除失败而重命名的包。删除 -kdocs
.
Package Version
------------------------------ ----------
-kdocs 1.1.2
mkdocs 1.1.2
但是,如果你运行pip uninstall -kdocs
或pip uninstall "-kdocs"
,你可能会得到以下错误:
$ pip uninstall "-kdocs"
Usage:
pip uninstall [options] <package> ...
pip uninstall [options] -r <requirements file> ...
no such option: -k
您可以直接从文件系统中删除包,而不是使用 pip uninstall
。
如果您列出 site-packages
目录,您可能会看到一个如下命名的子目录。请注意,这以波浪号 ~
而不是连字符 -
.
~kdocs-1.1.2.dist-info
所以使用:
$ cd /path/to/site-packages
$ ls
$ rm -rf ~kdocs-1.1.2.dist-info