【发布时间】:2021-07-17 05:23:18
【问题描述】:
我在 Windows 终端中使用 pip install sphinx 命令安装了 Sphinx,我想运行 sphinx-quickstart 在我的 docs 目录中创建文档,但它不起作用。
我得到了这个错误:
sphinx-quickstart : The term 'sphinx-quickstart' 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.
如果我尝试通过 GitBash 或在开头使用 py 或 python 运行它:
\path_to_python\python.exe: can't open file '\My_working_directory\docs\sphinx-quickstart': [Errno 2] No such file or directory
我该如何解决这个问题?
【问题讨论】:
-
发生这种情况的原因是因为 Sphinx 应该安装在您的虚拟环境中,并且您必须在使用它的终端上activate the virtual env。之后,无论您在何处运行,终端都会找到
sphinx-quickstart工具。如果您想查看它的位置,请参阅说明in this post。 -
python_installation_folder\Scripts在你的 PATH 中吗? -
我按照说明创建了目录。我启动了
.bat文件,现在终端一开始就有(tutorial-env),这很好。但是,如果我尝试在我的目录中调用sphinx-quickstart,它会告诉我:'sphinx-quickstart' 不被识别为内部或外部命令、可运行程序或批处理文件。 -
油,是的
-
好吧,我不知道为什么Sphinx没有出现在python安装文件夹的Scripts目录中,我需要在虚拟环境中重新安装。
标签: python python-3.x python-sphinx windows-terminal