好吧,我有一个让我质疑我使用计算机的能力的时刻之一。这不是我想象中的第一个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