0

我写了一个依赖于密钥环的包。

在我测试 Python 2.4 之前,一切都安装好 Python 2.7

这是我的setup.py

from setuptools import setup, find_packages

setup(
    name="blah",
    version='0.9dev',
    description="blah",
    package_dir = {'': 'src'},
    packages=find_packages('src'),
    include_package_data=True,
    zip_safe=False,
    install_requires=[
        'setuptools',
        'keyring',
        'argparse',
        'Cheetah'
    ],
    entry_points = """
    [console_scripts]
    A = A:main
    """,
)

我不断收到语法错误。
更新:这是我尝试安装软件包时看到的

Getting distribution for 'keyring'.
warning: no previously-included files found matching '.hg/last-message.txt'
  File "build/bdist.linux-x86_64/egg/keyring/tests/test_backend.py", line 65
    yield
         ^
SyntaxError: invalid syntax
  File "build/bdist.linux-x86_64/egg/keyring/tests/test_core.py", line 127
    with open(self.legacy_location, 'w') as f:
            ^
SyntaxError: invalid syntax
  File "build/bdist.linux-x86_64/egg/keyring/util/escape.py", line 21
    return c if c in LEGAL_CHARS else ESCAPE_FMT % ord(c)
              ^
SyntaxError: invalid syntax
zip_safe flag not set; analyzing archive contents...
keyring.core: module references __path__
keyring.tests.test_cli: module references __file__
  File "/home/bpm/Downloads/qc_processor/eggs/tmp4sN15a/keyring-0.8.1-py2.4.egg/keyring/tests/test_backend.py", line 65
    yield
         ^
SyntaxError: invalid syntax
  File "/home/bpm/Downloads/qc_processor/eggs/tmp4sN15a/keyring-0.8.1-py2.4.egg/keyring/tests/test_core.py", line 127
    with open(self.legacy_location, 'w') as f:
            ^
SyntaxError: invalid syntax
  File "/home/bpm/Downloads/qc_processor/eggs/tmp4sN15a/keyring-0.8.1-py2.4.egg/keyring/util/escape.py", line 21
    return c if c in LEGAL_CHARS else ESCAPE_FMT % ord(c)
4

1 回答 1

1

错误是由于使用了 Python 2.4 版之后添加的功能,例如with语句和条件表达式。例如,参见Python 2.5 的 What's New 文档

于 2012-03-29T00:08:26.687 回答