Python 找不到“sphinx-build”命令。
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/37757151/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
The 'sphinx-build' command was not found.
提问by Shaun Luttin
This was our processes of installing Sphinx.
这是我们安装 Sphinx 的过程。
> choco install python -y -f
> pip install sphinx
We know that sphinx installed because of the following output.
由于以下输出,我们知道安装了 sphinx。
> pip show sphinx
---
Metadata-Version: 2.0
Name: Sphinx
Version: 1.4.3
Summary: Python documentation generator
Home-page: http://sphinx-doc.org/
Author: Georg Brandl
Author-email: [email protected]
License: BSD
Location: c:\programdata\chocolatey\lib\python3\tools\lib\site-packages
We also added its install location to our PATH.
我们还将其安装位置添加到我们的 PATH。
c:\programdata\chocolatey\lib\python3\tools\lib\site-packages
Even so, running sphinx-build
does not work.
即便如此,跑步sphinx-build
也无济于事。
'sphinx-build' is not recognized as an internal or external command,
operable program or batch file.
回答by Symon
I stumbled into that problem too when installed Sphinx using pip
. The problem was solved using the installation way proposed by official documentation:
使用pip
. 使用官方文档提出的安装方式解决了问题:
For Python 3:
对于 Python 3:
$ apt-get install python3-sphinx
For Python 2:
对于 Python 2:
$ apt-get install python-sphinx
回答by Kim Paulissen
For macOS Mojave:
对于 macOS Mojave:
$ brew install sphinx-doc
upon install brew will notify you to add it to your path, so add the following line to your ~/.bash_profile:
安装 brew 时会通知您将其添加到您的路径中,因此将以下行添加到您的 ~/.bash_profile 中:
export PATH="/usr/local/opt/sphinx-doc/bin:$PATH"
after that you can run the sphinx-build command (you can verify this by for example checking the version)
之后,您可以运行 sphinx-build 命令(您可以通过例如检查版本来验证这一点)
$ sphinx-build --version
sphinx-build 2.0.1
回答by user9718458
For Windows:
对于 Windows:
Setting python path in make.bat
fixed the problem for me:
在中设置 python 路径make.bat
为我解决了这个问题:
set SPHINXBUILD="D:\Python3\Scripts\sphinx-build.exe"
回答by Shaun Luttin
We added the wrong directory to the path.
我们在路径中添加了错误的目录。
Wrong:
错误的:
c:\programdata\chocolatey\lib\python3\tools\lib\site-packages
Right:
对:
c:\programdata\chocolatey\lib\python3\tools\Scripts
回答by Wolfgang Fahl
For macports adding
对于 macports 添加
export PATH="/opt/local/Library/Frameworks/Python.framework/Versions/3.7/bin:$PATH"
to $HOME/.bash_profile fixed the issue
到 $HOME/.bash_profile 修复了这个问题