【问题标题】:Make HTML not working for Sphinx documentation in windows 10使 HTML 不适用于 Windows 10 中的 Sphinx 文档
【发布时间】:2020-12-27 23:44:42
【问题描述】:

我正在尝试关注tutorial,了解如何将 sphinx 和 Readthedocs 一起设置为项目。那天我在实习时使用了 Sphinx,使用 ubuntu 并且设置非常无缝。我刚刚在我的 anaconda power shell 上启动了sphinx-quickstart。当我尝试运行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.

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

【问题讨论】:

  • 该指南假定您使用 cmd.exe,但您在 PowerShell 控制台中。尝试运行.\make.bat html
  • 谢谢,这解决了我的问题。你能向我解释一下使用这些的区别吗?据我了解,powershell 通常带有更灵活的方法(并且更接近 UNIX)

标签: windows makefile anaconda python-sphinx


【解决方案1】:

展开上面的评论。

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

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

  • 您在安装了 (GNU) make 的 macOS 或 Linux 上,因此make html 执行Makefile 中定义的任务。
  • 您在 Windows 上并处于命令提示符 (cmd.exe),因此 make html 实际上调用了 make.bat

但是,您正在启动 PowerShell 控制台(“PS D:”表示这一点),因此您无法让 make html 正常工作。 PowerShell 不知道如何处理make,也不会自动调用make.bat

【讨论】:

    【解决方案2】:

    您可以尝试使用sphinx-build。据我所知,它可以完成工作并且不依赖于您使用的操作系统。

    sphinx-build <sourcedir> <outputdir>

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2019-09-26
      • 1970-01-01
      • 2019-02-03
      • 2021-05-03
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多