好吧,我有一个时刻让我质疑我使用电脑的能力。这不是我想作为我的第一个 SO 帖子提出的那种问题,但这里有。
从 Zed 的新“Learn Python the Hard Way”开始,因为我在中断了 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:更多新信息。在命令行...
c:\>python c:/python26/lib/pydoc.py file
...工作得很好。使用 PowerShell 中的 pydoc 一切正常,无需我担心 pwd、扩展或路径。