我安装了一个主题,在此之后,当我从命令行运行和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 PIP: 20.0.2
任何有关如何解决此错误的建议都将不胜感激。
发布于 2020-02-11 11:59:09
最后一行上的错误消息解释了该问题:
mkdocs.exceptions.ConfigurationError: The theme readthedocs is a builtin theme but -kdocs provides a theme with the same nameMkDocs包含一个名为readthedocs的内置主题。和内置主题名称是保留的。但是,MkDocs检测到另一个包已经向mkdocs.themes组注册了一个具有相同保留名称的主题。显然,这个包被命名为-kdocs,这很奇怪,因为python包通常不会以连字符(-)开头。
在任何情况下,解决方案都是删除具有非法主题名称的包。如果您最近安装了任何第三方主题,请尝试逐个卸载它们,直到命令pip uninstall packagename停止出现错误,其中packagename是要卸载的包的名称。要获得所有已安装软件包的列表,您可以使用pip freeze。
发布于 2021-03-03 19:16:13
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-infohttps://stackoverflow.com/questions/60137734
复制相似问题