Cygwin上的easy_install:unittest2导致SyntaxError

时间:2014-09-01 09:26:41

标签: python cygwin easy-install unittest2

我试图为Cygwin安装unittest2。我希望我能错过一些相对简单的东西,但我不知道它是什么。

$ easy_install --version
distribute 0.6.34

$ python --version
Python 3.2.5

当我尝试easy_install unittest2时,我得到以下输出:

$ easy_install -U unittest2
Searching for unittest2
Reading http://pypi.python.org/simple/unittest2/
Best match: unittest2 0.5.1
Downloading https://pypi.python.org/packages/source/u/unittest2/unittest2-0.5.1.zip#md5=1527fb89e38343945af1166342d851ee
Processing unittest2-0.5.1.zip
Writing /tmp/easy_install-ncoq7f/unittest2-0.5.1/setup.cfg
Running unittest2-0.5.1/setup.py -q bdist_egg --dist-dir /tmp/easy_install-ncoq7f/unittest2-0.5.1/egg-dist-tmp-ecnv6z
Traceback (most recent call last):
  File "/usr/bin/easy_install", line 9, in <module>
    load_entry_point('distribute==0.6.34', 'console_scripts', 'easy_install')()
  File "/usr/lib/python3.2/site-packages/setuptools/command/easy_install.py", line 1937, in main
    with_ei_usage(lambda:
  File "/usr/lib/python3.2/site-packages/setuptools/command/easy_install.py", line 1918, in with_ei_usage
    return f()
  File "/usr/lib/python3.2/site-packages/setuptools/command/easy_install.py", line 1941, in <lambda>
    distclass=DistributionWithoutHelpCommands, **kw
  File "/usr/lib/python3.2/distutils/core.py", line 148, in setup
    dist.run_commands()
  File "/usr/lib/python3.2/distutils/dist.py", line 917, in run_commands
    self.run_command(cmd)
  File "/usr/lib/python3.2/distutils/dist.py", line 936, in run_command
    cmd_obj.run()
  File "/usr/lib/python3.2/site-packages/setuptools/command/easy_install.py", line 358, in run
    self.easy_install(spec, not self.no_deps)
  File "/usr/lib/python3.2/site-packages/setuptools/command/easy_install.py", line 598, in easy_install
    return self.install_item(spec, dist.location, tmpdir, deps)
  File "/usr/lib/python3.2/site-packages/setuptools/command/easy_install.py", line 628, in install_item
    dists = self.install_eggs(spec, download, tmpdir)
  File "/usr/lib/python3.2/site-packages/setuptools/command/easy_install.py", line 823, in install_eggs
    return self.build_and_install(setup_script, setup_base)
  File "/usr/lib/python3.2/site-packages/setuptools/command/easy_install.py", line 1103, in build_and_install
    self.run_setup(setup_script, setup_base, args)
  File "/usr/lib/python3.2/site-packages/setuptools/command/easy_install.py", line 1089, in run_setup
    run_setup(setup_script, args)
  File "/usr/lib/python3.2/site-packages/setuptools/sandbox.py", line 34, in run_setup
    lambda: exec(compile(open(
  File "/usr/lib/python3.2/site-packages/setuptools/sandbox.py", line 82, in run
    return func()
  File "/usr/lib/python3.2/site-packages/setuptools/sandbox.py", line 37, in <lambda>
    {'__file__':setup_script, '__name__':'__main__'})
  File "setup.py", line 12, in <module>
  File "/tmp/easy_install-ncoq7f/unittest2-0.5.1/unittest2/__init__.py", line 40, in <module>
  File "/tmp/easy_install-ncoq7f/unittest2-0.5.1/unittest2/collector.py", line 3, in <module>
  File "/tmp/easy_install-ncoq7f/unittest2-0.5.1/unittest2/loader.py", line 92
    except Exception, e:
                    ^
SyntaxError: invalid syntax

发生了什么?

1 个答案:

答案 0 :(得分:1)

尝试easy_install unittest2py3khttps://pypi.python.org/pypi/unittest2py3k)。您收到的错误是由于Python 3(http://docs.pythonsprints.com/python3_porting/py-porting.html#exceptions

之间的语法更改造成的