pydoc fails under Windows and Python 2.6.4

前提是你 提交于 2019-12-11 12:48:50

问题


When trying to use pydoc under 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:


Typical windows problem: I had a program installed lately which brought its own Python 2.4. This installation overwrote the Windows file handlers for python scripts, but did not appear on the PATH. So scripts started from the console ran in the old-version python, but calling "python" ran the 2.6 version.

Thx to Nadia for the first hint.




回答2:


how about setting your PATH

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


来源:https://stackoverflow.com/questions/2199739/pydoc-fails-under-windows-and-python-2-6-4

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!