2014-04-11 31 views
0

我使用的是Ubuntu 13.10版本,並使得python項目在pyDev中使用eclipse IDE。我想編寫它的文檔。爲此,我按照鏈接Documenting python code using sphinx如何在Sphinx中製作文檔時給出系統路徑?

以下步驟:

$ sphinx-apidoc -A "Zeb Mustafa" -F -o docs MyPackage/src/ 

之後什麼路徑應該我應該在此處插入:

sys.path.insert(0,os.path.abspath('/home/zeb/MyPackage/src/')) 

我也試試這個:

sys.path.insert(0, os.path.abspath('MyPackage/src/')) 

以上兩行給錯誤

bash: syntax error near unexpected token `0,' 

我該如何給出路徑,以便conf.py應該知道用於製作文檔的代碼是什麼?

經過大量的挖掘這個問題。我ultimatly不喜歡:

$ make html 

而且

[email protected]:~$ cd docs/ 
[email protected]:~/docs$ make html 
[email protected]:~/docs$ sphinx-build -b html -d _build/doctrees . _build//html 

所有.html文件是空的。沒有顯示任何文件。

回答

0

嘗試:

sys.path.insert(0, os.path.abspath('..')) 

如果它不能正常工作,請提供您的項目的文件夾結構。

另請參閱Python-Sphinx: How to document one file with functions?,示例命令可能會有幫助。

+0

感謝您的回覆,當我編輯conf.py來指定sys.path:'#sys.path.insert(0,os.path.abspath('。'))'時,同樣的問題,當我通過使用終端的錯誤:'bash:語法錯誤附近的意外令牌'0,''。我也取消了'conf.py'中的路徑,但是沒有任何改變 – Zeb

相關問題