好吧,我有一个时刻让我质疑我使用电脑的能力。这不是我在第一篇SO帖子中想要问的问题,但这里是这样的。
从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...works很好。在PowerShell中使用pydoc一切都很好,不用担心pwd、扩展或路径。
发布于 2013-12-09 03:55:18
在Windows Powershell中使用: python -m pydoc
示例:
python -m pydoc打开
python -m pydoc raw_input
python -m pydoc argv
发布于 2011-01-05 01:50:07
当您在windows命令提示符下键入文件名时,cmd可以检查windows注册表中的默认文件关联,并使用该程序打开它。因此,如果Inkscape安装程序将.py文件与它自己的python版本相关联,cmd可能会优先运行该文件,而完全忽略路径。参见this question。
发布于 2010-11-11 13:05:40
根据您的第二次编辑,您的路径中可能有多个pydoc.py副本,首先是“错误的”副本,因此当它启动时,它没有正确的执行环境。
https://stackoverflow.com/questions/4149274
复制相似问题