好吧,我有一個讓我質疑我使用計算機的能力的時刻之一。這不是我想象中的第一個SO帖子,但這裏就是這樣。Windows 7 - 從cmd的pydoc
開始使用Zed的新「學習Python的難題」,因爲我一直在尋找10年中斷和python之後迴歸編程的東西,這總是我想要的。這本書真的跟我說過。話雖如此,我從命令中遇到了pydoc的嚴重問題。我已經在我的系統路徑中獲得了c:/ python26中的所有目錄,並且無論pwd如何,我都可以從命令行執行pydoc - 但它不接受任何參數。不管我輸入什麼內容,我只是得到標準的pydoc輸出,告訴我可接受的參數。
任何想法?對於它的價值,我按照Zed的建議安裝了ActivePython。
C:\Users\Chevee>pydoc file
pydoc - the Python documentation tool
pydoc.py <name> ...
Show text documentation on something. <name> may be the name of a
Python keyword, topic, function, module, or package, or a dotted
reference to a class or function within a module or module in a
package. If <name> contains a '\', it is used as the path to a
Python source file to document. If name is 'keywords', 'topics',
or 'modules', a listing of these things is displayed.
pydoc.py -k <keyword>
Search for a keyword in the synopsis lines of all available modules.
pydoc.py -p <port>
Start an HTTP server on the given port on the local machine.
pydoc.py -g
Pop up a graphical interface for finding and serving documentation.
pydoc.py -w <name> ...
Write out the HTML documentation for a module to a file in the current
directory. If <name> contains a '\', it is treated as a filename; if
it names a directory, documentation is written for all the contents.
C:\Users\Chevee>
編輯:新的信息,pydoc在PowerShell中工作得很好。作爲一名Linux用戶,我不知道爲什麼我試圖使用cmd - 但我仍然很想弄清楚pydoc和cmd有什麼問題。
編輯2:更多的新信息。在cmd ...
c:\>python c:/python26/lib/pydoc.py file
...工作得很好。在PowerShell中,只要使用pydoc,一切都可以正常工作,而不必擔心pwd或擴展或路徑。
顯示示例控制檯會話指出問題,最好是從cmd窗口複製/粘貼的問題。 (編輯你的文章,不要添加答案或評論)。另外,在編輯窗口中選擇文本後,使用10101010按鈕將其格式化爲代碼。 – 2010-11-10 21:40:59
如果您輸入命令爲'pydoc.py ...'而不是'pydoc ...',會發生什麼情況? – 2010-11-10 22:56:09
@Jim Garrison - 同樣的輸出。我設置了一個文件關聯for.py到python.exe,所以我不必輸入擴展名。這可能是我的問題嗎? – 2010-11-10 23:11:15