How to get pydoc command working in windows 7 cmd?

I am learning a Python program with the Learning Python Hard Way. In one of the chapters, he tells me to use the pydoc command. Window 7 cmd failed with this command.

When I typed pydoc raw_input() on cmd, the following error codes were generated:

 'pydoc' is not recognized as internal or external command, operable program or batch file. 

I reviewed the previous two questions on the same issue:

So far I have created pydoc.bat with the following line

 @python c:\Python26\lib\pydoc.py %* 

and saved it in C:\python27\Tools\Scripts .

I also tried changing PATH to C:\python27\Lib . I named the two variables python and pydoc because I'm not sure if I set PATH correctly.

It still does not work.

What have I done wrong?

+6
source share
12 answers

To get python help when in a PowerShell window type:

 python -m pydoc raw_input 

submenu of your function name for raw_input.

+15
source

You have added this to your script file:

  @python c: \ Python26 \ lib \ pydoc.py% *

But it seems that you are using python 2.7

+3
source

Hey, I know this post is a little old, but I wanted to let you (and everyone else) know about this:

 C:\Python27\Tools\scripts\pydocgui.py 

It installs the web server on localhost:7464 . Just visit the address in your browser and you have access to pydoc :) Hope this helps someone.

+3
source

I am running Windows 7. I am using the command line, cmd. I am learning Python from Learning Python Hard Way. I had the same problem as you, and I tried to solve it on my own from what you gave me. Here is what I got:

In gedit I typed

@python C: \ Python27 \ Lib \ pydoc.py% *

It is important to note two parts:

C: \ is capitalized, L in Lib is capitalized. Both of them were left unchanged, and this created a syntax error when I tried to run it.

I saved it as

pydoc.bat

from gedit to C: \ Python27 \ Tools \ Scripts.

From cmd, I cd'd to the specified address. From C: \ Python27 \ Tools \ Scripts I typed pydoc.bat open and it worked. He showed me the information I needed.

The only difference between what you have done and what I do is the capitalization of certain letters. Check your input and make sure it matches what the computer should see.

+2
source

Copy the bat file to this path.

  C: \ python27 

and then run it like:

  pydoc.bat raw_input

this should work. make sure the PATH parameter is set to:

  C: \ python27

This will help you run the bat file from anywhere in the cmd line.

0
source

There are several ways to fix this:

  • Check if there is a path that you added to PATH. Type PATH at the command prompt. If the path you added is missing, restart Windows. If this is the next line.

  • Type pydoc.py instead of pydoc

  • If you do not want to add the pydoc module extension each time, just add the .PY extension to the PATHEXT variable located in the same place as the PATH variable (Computer β†’ Properties β†’ Advanced system settings β†’ Advanced β†’ Environment variables ... β†’ System variables -> PATHEXT). Restart Windows after adding the extension.

0
source

Enter Pydoc.py x, replacing x with any document you want to read.

For example Pydoc.py raw_input (in cmd of course)

Remember to change the path to the lib directory. do it like this:

Right-click on my computer> properties> Advanced tab> environment variables> find the PATH value in the system variables> edit> enter this β†’; C: / Python27 / lib

0
source

Here's how you do it from scratch / layman (my type) while learning python:

If you have a 32-bit Win7 system without an environment variable manually installed after installation (basically nothing was done after installing it) python 2.7 or any version lower than python 3 from the site, follow these steps:

1) Open a command prompt and enter (in the exact case):

 cd\ 

until you return to the "C: \" directory (the root / base directory where your python is installed).

2) Then enter:

 cd Python27 

Since my base directory or drive is drive C, my path is this: yours may be different so you enter the path of the Python27 folder (or 26 or the name of your python folder) where you installed Python2.7 (or any other version).

3) Then enter:

 cd Lib 

You have just entered the library folder where the pydoc.py file is present by default from the Internet by default (for me it was).

4) Then just enter:

 pydoc.py 

You will get the required pydoc output, which apparently refers to the β€œpersonal” PERL / Linux page or the C / Windows Help page.

5) Then just enter:

 pydoc.py raw_input 

The name of the required command for which you want to see the documentation.

Now you know how to do this for all the other teams.

0
source

set the path as

C: \ Python27> python (or wherever you install python)

Then write the command -m pydoc raw_input which will look like

 C:\Python27>python -m pydoc raw_input 

Note: there is a space between python and -m

0
source

I have an answer: see that we ran pydoc raw_input in cmd, but we forget that to run python files we need to type .py at the end of the im file using Windows 7 NVidia, to start you, you must be in it Dir C:\Python27\Lib , then type pydoc.py and type.

There you hope it was helpful.

-1
source

you should not be in the correct directory on the command line when entering "pydoc raw_input"

first type:

 cd\python27\lib 

then enter:

 pydoc raw_input 
-1
source

Enter python environment:

C:\>python

and then just use the help command.

>>> help(raw_input)

-1
source

Source: https://habr.com/ru/post/886521/


All Articles