pydoc 在 Windows 和 Python 2.6.4 下失败

发布于 2024-08-20 09:56:14 字数 427 浏览 3 评论 0原文

当尝试在 Windows 和 python.org 2.6.4 下使用 pydoc 时,出现以下错误:

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

这里可能出了什么问题?

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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

血之狂魔 2024-08-27 09:56:14

典型的 Windows 问题:我最近安装了一个程序,它自带了 Python 2.4。此安装覆盖了 python 脚本的 Windows 文件处理程序,但没有出现在 PATH 中。因此,从控制台启动的脚本在旧版本的 python 中运行,但调用“python”运行 2.6 版本。

感谢 Nadia 的第一个提示。

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.

岛歌少女 2024-08-27 09:56:14

设置你的 PATH 怎么样

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

how about setting your PATH

c:\> set PATH=C:\Python26\Lib;%PATH%
c:\> pydoc.py sys
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文