好吧,我有其中一个让我质疑我使用电脑的能力.这不是我想象的那个问题,而是我的第一篇SO帖子,但是这里就是这样.
开始于Zed的新"学习Python艰难的方式",因为我一直希望在10年的间歇后回到编程中,而python总是我想要的.这本书真的跟我说过.话虽这么说,我从命令中遇到了严重的pydoc问题.我在我的系统路径中有c:/ python26中的所有目录,我可以从命令行执行pydoc,无论pwd如何 - 但它不接受任何参数.无论我输入什么,我只是得到标准的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>
Run Code Online (Sandbox Code Playgroud)
编辑:新信息,pydoc在PowerShell中运行良好.作为一个Linux用户,我不知道为什么我还是试图使用cmd - 但我仍然想知道pydoc和cmd是什么.
编辑2:更多新信息.在cmd ...
c:\>python c:/python26/lib/pydoc.py file
Run Code Online (Sandbox Code Playgroud)
......工作得很好.在PowerShell中只需pydoc就可以正常工作,而不用担心pwd,扩展或路径.
在Windows Powershell中使用:python -m pydoc
例子:
python -m pydoc打开
python -m pydoc raw_input
python -m pydoc argv