import cloudstorage,SyntaxError:无效语法

2024-09-28 04:19:45 发布

您现在位置:Python中文网/ 问答频道 /正文

我想用Google Cloud Storage Client Library Functions。在

为此我必须import cloudstorage。为了得到cloudstorage,我下载了Google Cloud Storage client library。在

我尝试使用python -c "import cloudstorage"导入cloudstorage。 我得到以下错误:

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/Users/fghavamian/Documents/PhD_work/Codes/python/convnet_gcloud/cloudstorage/__init__.py", line 20, in <module>
    from .api_utils import RetryParams
  File "/Users/fghavamian/Documents/PhD_work/Codes/python/convnet_gcloud/cloudstorage/api_utils.py", line 173
    except self.retriable_exceptions, e:
                                    ^
SyntaxError: invalid syntax

我错过什么了吗?在


Tags: inimportcloudgooglelinestorageusersdocuments
1条回答
网友
1楼 · 发布于 2024-09-28 04:19:45

正如其中一条评论所说,这是使用python3的一个问题,因为python3的语法已经改变。您使用的Google云存储库似乎没有得到很好的支持,more recommended库是{a2}。在

如果您已经安装了Google Cloud SDK,可以使用下面的命令进行安装:

pip install google-cloud-storage

下面是一些示例代码(from the docs),演示了如何读写一个bucket。在

^{pr2}$

相关问题 更多 >

    热门问题