[英]Python - google-cloud library - error in Google Cloud Shell
我正在嘗試在Google Cloud Shell中執行以下簡單的python片段:
from google.cloud import bigquery
client = bigquery.Client()
print(client)
我收到以下錯誤:
./test.py: line 2: $'\r': command not found
./test.py: line 3: syntax error near unexpected token `('
'/test.py: line 3: `client = bigquery.Client()
有人可以讓我知道我做錯了什么嗎?
非常感謝。
Cloud Shell是Shell,而不是Python REPL。 您應該先輸入python
才能輸入Python REPL,然后輸入您要運行的Python調用。 例如:
Welcome to Cloud Shell! Type "help" to get started.
Your Cloud Platform project in this session is set to my-project.
Use “gcloud config set project [PROJECT_ID]” to change to a different project.
dustiningram@cloudshell:~ (my-project)$ python
Python 2.7.13 (default, Nov 24 2017, 17:33:09)
[GCC 6.3.0 20170516] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from google.cloud import bigquery
>>> client = bigquery.Client()
>>> print(client)
<google.cloud.bigquery.client.Client object at 0x7f86802b5050>
>>>
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.