命令重启和 运行 全部在 Google 协作中?

Command to restart and run all in Google Collab?

我在 Google Collab 中有以下代码,当手动 运行 时,由于雪花库,需要我重新启动和 运行 手动。

但是,我想在 GCP 上完成包含此代码段的代码并运行它。

import requests
import pandas as pd
import datetime as dt
from datetime import timedelta
!pip install snowflake
!pip install snowflake-connector-python==2.3.7
!pip install -r https://raw.githubusercontent.com/snowflakedb/snowflake-connector-python/v2.3.7/tested_requirements/requirements_36.reqs
import snowflake.connector as snow
from snowflake.connector.pandas_tools import write_pandas
!pip install snowflake-sqlalchemy
from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker
from snowflake.sqlalchemy import URL

我怎样才能让 Google 云应用程序拥有这个库并能够一次性 运行 上面的脚本?如果我做不到,有没有办法通过命令重新启动并运行?

https://cloudblog.withgoogle.com/products/application-development/how-to-schedule-a-recurring-python-script-on-gcp/amp/

您正在寻找的可能是 Google 适合您 Python 的云功能。在为 运行 设置云函数时,您上传代码和库,以便在您要执行该函数时已经安装它们。看看这个指南,它非常完整和详细:

https://cloud.google.com/functions/docs/quickstart-python