我之前用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是干什么的,大家可以看這里。 以后有時間的話,我會寫幾個例子來講解它的用法。