首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Windows 7-来自cmd的pydoc

Windows 7-来自cmd的pydoc
EN

Stack Overflow用户
提问于 2010-11-11 05:30:46
回答 5查看 9.3K关注 0票数 4

好吧,我有一个时刻让我质疑我使用电脑的能力。这不是我在第一篇SO帖子中想要问的问题,但这里是这样的。

从Zed的新的“以艰难的方式学习Python”开始,因为我一直在寻找在中断10年后重新进入编程领域,而python一直是我想要的。这本书对我真的很有启发。这就是说,我在司令部对pydoc有一个严重的问题。我的系统路径中有c:/python26中的所有目录,无论pwd如何,我都可以从命令行执行pydoc --但它不接受任何参数。不管我输入什么,我只得到标准的pydoc输出,告诉我可接受的参数。

有什么想法吗?无论如何,我按照Zed的建议安装了ActivePython。

代码语言:javascript
复制
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中...

代码语言:javascript
复制
c:\>python c:/python26/lib/pydoc.py file

...works很好。在PowerShell中使用pydoc一切都很好,不用担心pwd、扩展或路径。

EN

回答 5

Stack Overflow用户

发布于 2013-12-09 03:55:18

在Windows Powershell中使用: python -m pydoc

示例:

python -m pydoc打开

python -m pydoc raw_input

python -m pydoc argv

票数 7
EN

Stack Overflow用户

发布于 2011-01-05 01:50:07

当您在windows命令提示符下键入文件名时,cmd可以检查windows注册表中的默认文件关联,并使用该程序打开它。因此,如果Inkscape安装程序将.py文件与它自己的python版本相关联,cmd可能会优先运行该文件,而完全忽略路径。参见this question

票数 2
EN

Stack Overflow用户

发布于 2010-11-11 13:05:40

根据您的第二次编辑,您的路径中可能有多个pydoc.py副本,首先是“错误的”副本,因此当它启动时,它没有正确的执行环境。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/4149274

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档