使 HTML 不适用于 Windows 10 中的 Sphinx 文档

Gui*_*eis 6 windows makefile python-sphinx anaconda

我正在尝试遵循有关如何为项目设置 sphinx 和 Readthedocs 的教程。我当时在实习时使用过 Sphinx,在 ubuntu 上,设置非常无缝。我刚刚sphinx-quickstart在我的 anaconda power shell 上启动了 。当我尝试运行时make html出现以下错误:

(base) PS D:\code\RaspberryServer\docs> make html
make : The term 'make' is not recognized as the name of a cmdlet, function, script file, or operable program. Check
the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:1
+ make html
+ ~~~~
    + CategoryInfo          : ObjectNotFound: (make:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException


Suggestion [3,General]: The command make was not found, but does exist in the current location. Windows PowerShell does not load commands from the current location by default. If you trust this command, instead type: ".\make". See "get-help about_Command_Precedence" for more details.
Run Code Online (Sandbox Code Playgroud)

首先我认为这是因为我从未安装过MinGW。但即使这样做之后,我似乎也没有解决问题,而且我不知道如何开始调查它。我的Python安装完全基于Anaconda。

Lex*_* Li 16

展开上面的评论。

sphinx 生成的默认站点假设您使用make html在多个操作系统上使用来生成 HTML 页面。

这是通过典型的假设实现的,

  • 您在 macOS 或 Linux 上安装了 (GNU) make,所以make html执行Makefile.
  • 您在 Windows 上并处于命令提示符 ( cmd.exe) 下,因此make html实际上调用make.bat.

但是,您正在启动 PowerShell 控制台(“PS D:”表示),因此您无法make html正常工作。PowerShell 不知道如何处理make,也不会make.bat自动调用。你需要.\make.bat html改为打电话。

  • 浪费了很多时间来找到这个——我希望他们把这个放在首页上! (3认同)
  • 事实上,我还发现很奇怪的是,文档解释了如何创建目录(mkdir)以及如何进入目录(cd),但随后让您完全独自执行“make html”。 (3认同)