Python make: ../bin/sphinxbuild:命令未找到 解决办法

我之前用easy_install pyquery安装了pyquery这个框架,但是发现没有文档,因此我去它的网站下了一份源代码,幸好里面有docs文件,打开看了下,是还没有编译的,于是在终端中输入make:

huangjacky@huangjacky-laptop:~/program/code/Python_Framework/pyquery/docs$ make
 Please use `make <target>' where <target> is one of
 html to make standalone HTML files
 pickle to make pickle files
 json to make JSON files
 htmlhelp to make HTML files and a HTML help project
 latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter
 changes to make an overview over all changed/added/deprecated items
 linkcheck to check all external links for integrity

提示要带参数,我们需要输出html的,所以就输入make html:

huangjacky@huangjacky-laptop:~/program/code/Python_Framework/pyquery/docs$ make html
mkdir -p _build/html _build/doctrees
../bin/sphinx-build -b html -d _build/doctrees . _build/html
make: ../bin/sphinx-build:命令未找到
make: *** [html] 错误 127

提示sphinx-build没有找到,说明它使用到什么东西,我们没有安装,google了一下,原来是一个python的库,于是在终端输入 sudo easy_install Sphinx,安装成功了。 再次在终端中输入make html 但是还是同样的错误,看了下它../bin/sphinx-build,看来它把人家sphinx当成自己的一个文件夹了,好吧,我们直接用sphinx-build命令对docs文件夹生成html吧,在终端中输入:sphinx-build 需要编译的docs文件夹 输出的目录

huangjacky@huangjacky-laptop:~/program/code/Python_Framework/pyquery$ sphinx-build docs html
Making output directory...
Running Sphinx v1.1.3
loading pickled environment... not yet created
No builder selected, using default: html
building [html]: targets for 11 source files that are out of date
updating environment: 11 added, 0 changed, 0 removed
Traceback (most recent call last): 
 File "/usr/local/lib/python2.7/dist-packages/Sphinx-1.1.3-py2.7.egg/sphinx/ext/autodoc.py", line 321, in import_object
 __import__(self.modname)
 File "/usr/local/lib/python2.7/dist-packages/pyquery-1.2.1-py2.7.egg/pyquery/ajax.py", line 6, in <module>
 from webob import Request, Response
ImportError: No module named webob
reading sources... [100%] traversing 
/home/huangjacky/program/code/Python_Framework/pyquery/docs/ajax.txt:4: WARNING: autodoc can't import/find module 'pyquery.ajax', it reported error: "No module named webob", please check your spelling and sys.path
/home/huangjacky/program/code/Python_Framework/pyquery/docs/ajax.txt:54: WARNING: don't know which module to import for autodocumenting u'PyQuery' (try placing a "module" or "currentmodule" directive in the document, or giving an explicit module name)
/usr/local/lib/python2.7/dist-packages/pyquery-1.2.1-py2.7.egg/pyquery/pyquery.py:docstring of pyquery.pyquery.PyQuery.html:9: WARNING: Inline literal start-string without end-string.
looking for now-outdated files... none found
pickling environment... done
checking consistency... done
preparing documents... done
writing output... [100%] traversing 
writing additional files... genindex py-modindex search
copying static files... WARNING: html_static_path entry '/home/huangjacky/program/code/Python_Framework/pyquery/docs/_static' does not exist
done
dumping search index... done
dumping object inventory... done
build succeeded, 4 warnings.

输出了一大段的提示,但是可以看到最后提示build succeeded,哈哈发现和docs同目录下已经生成了html文件夹。 搞定了。 至于pyquery是干什么的,大家可以看这里。 以后有时间的话,我会写几个例子来讲解它的用法。

原文地址:https://www.cnblogs.com/huangjacky/p/2592671.html