我之前用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 htmlmkdir -p _build/html _build/doctrees../bin/sphinx-build -b html -d _build/doctrees . _build/htmlmake: ../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 htmlMaking output directory...Running Sphinx v1.1.3loading pickled environment... not yet createdNo builder selected, using default: htmlbuilding [html]: targets for 11 source files that are out of dateupdating environment: 11 added, 0 changed, 0 removedTraceback (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, ResponseImportError: No module named webobreading 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 foundpickling environment... donechecking consistency... donepreparing documents... donewriting output... [100%] traversing writing additional files... genindex py-modindex searchcopying static files... WARNING: html_static_path entry '/home/huangjacky/program/code/Python_Framework/pyquery/docs/_static' does not existdonedumping search index... donedumping object inventory... donebuild succeeded, 4 warnings.
輸出了一大段的提示,但是可以看到最後提示build succeeded,哈哈發現和docs同目錄下已經產生了html檔案夾。 搞定了。 至於pyquery是幹什麼的,大家可以看這裡。 以後有時間的話,我會寫幾個例子來講解它的用法。