Pydoc crashes under Windows and Python 2.6.4

When trying to use pydoc on Windows and python.org 2.6.4, I get the following error:

C:\>pydoc sys
'import site' failed; use -v for traceback
Traceback (most recent call last):
  File "C:\programs\Python26\Lib\pydoc.py", line 55, in ?
    import sys, imp, os, re, types, inspect, __builtin__, pkgutil
  File "C:\programs\Python26\Lib\os.py", line 758
    bs = b""
           ^
SyntaxError: invalid syntax

What could be wrong here?

+1
source share
2 answers

Typical windows problem: I had a recently installed program that brought my own Python 2.4. This installation overwrite the Windows file handlers for python scripts, but did not appear in PATH. Thus, scripts launched from the console were run on python of the old version, but the call to "python" was performed by version 2.6.

thanks to Nadia for the first tip.

+2
source

how to set PATH

c:\> set PATH=C:\Python26\Lib;%PATH%
c:\> pydoc.py sys
0
source

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


All Articles