0

我正在尝试安装 parsley,这是一个用 python 编写的解析器,但我遇到了第一个障碍。我什至无法安装它。我在 Windows 7 上,使用 cygwin。

而这个版本的python: $ python3 -V Python 3.4.2

$ pip install Parsley
Downloading/unpacking Parsley
  Running setup.py (path:C:\cygwin64\tmp\pip_build_ds\Parsley\setup.py) egg_info for package Parsley

Installing collected packages: Parsley
  Running setup.py install for Parsley
      File "C:\Python34\Lib\site-packages\ometa\interp.py", line 252
        except ParseError, err:
                         ^
    SyntaxError: invalid syntax

      File "C:\Python34\Lib\site-packages\ometa\runtime.py", line 484
        except ParseError, e:
                         ^
    SyntaxError: invalid syntax

      File "C:\Python34\Lib\site-packages\ometa\test\test_pymeta.py", line 101
        self.assertEqual(g.stuff([17, 0x1f, -2, 0177]), 0177)
                                                   ^
    SyntaxError: invalid token

      File "C:\Python34\Lib\site-packages\ometa\vm_builder.py", line 7
        print "Gonna compile", expr
                            ^
    SyntaxError: Missing parentheses in call to 'print'

      File "C:\Python34\Lib\site-packages\parsley.py", line 86
        except ParseError, e:
                         ^
    SyntaxError: invalid syntax

      File "C:\Python34\Lib\site-packages\terml\test\test_terml.py", line 40
        Term(Tag('.int.'), 0755, None, None))
                              ^
    SyntaxError: invalid token

Successfully installed Parsley
Cleaning up...

然后在python的IDLE中:

>>> import parsley
Traceback (most recent call last):
  File "<pyshell#5>", line 1, in <module>
    import parsley
  File "C:\Python34\lib\site-packages\parsley.py", line 86
    except ParseError, e:
                     ^
SyntaxError: invalid syntax

我究竟做错了什么?

4

1 回答 1

1

Parsley(目前为 1.2)不支持 Python 3.x。

您需要使用 Python 2.x 才能使用该包。

于 2015-07-29T08:38:41.843 回答