【问题标题】:Pygments import Lex errorPygments 导入 Lex 错误
【发布时间】:2015-08-14 23:59:28
【问题描述】:

我尝试使用以下代码导入 lex:

from pygments import lex

但它只返回一个错误:

Traceback (most recent call last):
  File "D:\samp.py", line 1, in <module>
    from pygments import lex
  File "C:\Python32\lib\site-packages\pygments-2.0.2-py3.2.egg\pygments\__init__.py", line 37, in <module>
    from pygments.util import StringIO, BytesIO
  File "C:\Python32\lib\site-packages\pygments-2.0.2-py3.2.egg\pygments\util.py", line 226
    return u'[%s-%s]' % (unichr(a), unichr(b))
                    ^
SyntaxError: invalid syntax

(我在 IDLE 上使用 Python 3.2.3)

有解决办法吗?

【问题讨论】:

    标签: python tkinter pygments


    【解决方案1】:

    似乎有人已经将此记录为错误here

    分辨率是-

    Pygments 2.0 需要 Python 3.3+。

    你应该安装 Python 3.3 或更高版本,然后在上面安装 pygment。

    【讨论】:

    • 非常感谢,已修复。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2023-03-19
    • 1970-01-01
    • 2017-08-30
    • 1970-01-01
    相关资源
    最近更新 更多