2012-03-29 58 views
0

我寫了一個依賴於keyring的包。如何在Python 2.4中使用keyring?

一切都安裝罰款與Python 2.7,直到我測試的Python 2.4

這裏是我的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 
    """, 
) 

我不斷收到語法錯誤。
UPDATE:這是我看到的時候我嘗試安裝包

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) 
+0

_What_語法錯誤? – sarnold 2012-03-29 00:04:29

回答

1

的錯誤是由於使用所添加到Python 2.4版本後,像with語句和條件表達式的功能。例如參見the What's New document for Python 2.5

+0

那麼我如何獲得keyring只是爲了Python 2.4? – BPm 2012-03-29 00:14:32

+1

我不知道。假設你在這裏討論這個包(http://pypi.python.org/pypi/keyring),列出的最新版本是0.8.1,並聲稱在2.4上支持。你展示的'setup.py'文件是0.9dev,所以推測是最新的開發版本。你可以嘗試安裝舊版本。 – 2012-03-29 00:26:03

+0

我能夠在Python 2.4.x中使用的唯一版本的keyring是v0.5,可在https://pypi.python.org/packages/source/k/keyring/keyring-0.5.tar.gz – 2014-05-09 09:43:14

相關問題