Pydoc is not working (Windows XP)

2019-01-18 14:18发布

Using Windows XP and Python 2.7 I tried to run "pydoc" through the terminal. unfortunately it doesn't work.

Since I'm not allowed to post a screenshot (Newbie). Here is what it says (white on black)

What I type:

"C:\Python27>pydoc raw_input  /"pydoc raw_input"

My result (It's German an it roughly translates to"The command "pydoc" is either spelled wrong or couldn't be found.):

Der Befehl "pydoc" ist entweder falsch geschrieben oder konnte nicht gefunden werden. 

What am I doing wrong?

By the way, I just started to teach myself programming using Zed Shaws "Learn Python the Hard Way" and this is the first issue I really can't figure out using Google. I start to believe that it is Windows an not me... (being too broke to afford a Mac and to scared to learn Linux).

8条回答
Root(大扎)
2楼-- · 2019-01-18 15:00
  1. Check if path you've added to PATH is in there. Type in command line PATH. If path you've added isn't there then Restart Windows. If it is go next line.

  2. Type pydoc.py instead of pydoc

  3. If you don't want type pydoc module extension every time, just add .PY extension to PATHEXT variable located at the same place as PATH variable does (Computer → Properties → Advanced system settings → Advanced → Environment Variables... → System Variables → PATHEXT). Restart your Windows after adding of extension.

查看更多
混吃等死
3楼-- · 2019-01-18 15:07

pydoc is actually a Python script (so, on Windows, you need to look for pydoc.py), and it's not added to the Windows %PATH% by default (so you need to give a full pathname).

Try running c:\Python27\Lib\pydoc.py from your command line.

Edit: For a graphical interface to Python's documentation, you might want to instead run c:\Python27\Tools\Scripts\pydocgui.pyw (from the command line or from Windows Explorer). This starts pydoc's web server on your local PC so you can access the documentation through your web browser.

查看更多
Root(大扎)
4楼-- · 2019-01-18 15:09

In Windows,you should type python pydoc.py in this directory(c:\Python27\lib) in the powershell,then you will see what you want.

PS: pay attention to the full path to pydoc.py

查看更多
孤傲高冷的网名
5楼-- · 2019-01-18 15:11

you can also type help() when you are in the Python terminal which gets you to the same page...

http://docs.python.org/library/pydoc.html

查看更多
Explosion°爆炸
6楼-- · 2019-01-18 15:14

The simplest way to do this would be to change to the Python27/Lib directory and run the command from there, like so:

C:\Documents and Settings\username>cd C:\Python27\Lib

C:\Python27\Lib>python pydoc.py raw_input
Help on built-in function raw_input in module __builtin__:
查看更多
ゆ 、 Hurt°
7楼-- · 2019-01-18 15:22

Just put C:\Python27\Lib in your PATH environment variable and be done with it once and for all. Works for me.

查看更多
登录 后发表回答