dropbox python api import dropbox语法错误

时间:2014-11-19 19:13:42

标签: python dropbox

使用Python 2.6.6

尝试安装dropbox python api ..

试过两个' pip install dropbox'和' python setup.py install'

导入保管箱

时出现此错误
Traceback (most recent call last):

    File "<stdin>", line 1, in <module>
    File "/usr/lib/python2.6/site-packages/dropbox/__init__.py", line 3, in <module>
    from . import client, rest, session
    File "/usr/lib/python2.6/site-packages/dropbox/client.py", line 22, in <module>
    from .rest import ErrorResponse, RESTClient, params_to_urlencoded
    File "/usr/lib/python2.6/site-packages/dropbox/rest.py", line 415
    utf8_params = {encode(k): encode(v) for k, v in params.iteritems()}
                                      ^
SyntaxError: invalid syntax

我做错了什么..?

1 个答案:

答案 0 :(得分:2)

Dropbox API中的代码似乎使用dictionary comprehensions,直到Python 2.7才会引入。对于此模块,也可以在the PyPI page上看到这一点,该模块将2.7列为所需的Python版本。除非升级到Python 2.7,否则您将无法使用此模块。 (根据this question,它必须是Python 2.7,因为API还不支持Python 3.)