无法安装cloudstorage

时间:2017-10-30 06:55:10

标签: python cloud-storage

在我尝试导入时使用pip安装cloudstorage模块后 得到以下错误。

import cloudstorage
Traceback (most recent call last):


File "<stdin>", line 1, in <module>
  File "/Users/keshaw/vinv/lib/python2.7/site-packages/cloudstorage/__init__.py", line 56
    def get_driver(driver: DriverName) -> Drivers:
                         ^
SyntaxError: invalid syntax

我尝试安装不同的版本,但同样的问题

1 个答案:

答案 0 :(得分:2)

您使用的是python3吗?似乎存在语法错误。 Typing在python2中不可用。 Python2:

Python 2.7.13 (default, Jan 19 2017, 14:48:08) 
[GCC 6.3.0 20170118] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> def get_driver(driver: str) -> str:
  File "<stdin>", line 1
    def get_driver(driver: str) -> str:
                         ^
SyntaxError: invalid syntax
>>> 

Python3:

Python 3.5.3 (default, Sep 14 2017, 22:58:41) 
[GCC 6.3.0 20170406] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> def get_driver(driver: str) -> str:
... 

在python3中,你的语法应该有效:)