Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/xpath/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
将Python文件上载到GCP并执行代码_Python_Google Cloud Platform - Fatal编程技术网

将Python文件上载到GCP并执行代码

将Python文件上载到GCP并执行代码,python,google-cloud-platform,Python,Google Cloud Platform,我试图创建一个VM,将一些python文件上传到GCP,并在我的bucket上运行代码 我创建了VM,并将SSH插入其中。在我用我需要的所有Python库设置VM实例之后。现在我尝试将python文件上传到GCP,以便执行代码 因此,在我的Mac电脑上,我做了gcloud init,然后尝试了以下操作: gcloud compute scp /Users/username/Desktop/LZ_demo_poc/helper_functions.py /home/user_name/lz_tex

我试图创建一个VM,将一些python文件上传到GCP,并在我的bucket上运行代码

我创建了VM,并将SSH插入其中。在我用我需要的所有Python库设置VM实例之后。现在我尝试将python文件上传到GCP,以便执行代码

因此,在我的Mac电脑上,我做了
gcloud init
,然后尝试了以下操作:

gcloud compute scp /Users/username/Desktop/LZ_demo_poc/helper_functions.py /home/user_name/lz_text_classification/
但是,我一直收到这些错误消息

WARNING: `gcloud compute copy-files` is deprecated.  Please use `gcloud compute scp` instead.  Note that `gcloud compute scp` does not have recursive copy on by default.  To turn on recursion, use the `--recurse` flag.
ERROR: (gcloud.compute.copy-files) Source(s) must be remote when destination is local.  Got sources: [/Users/username/Desktop/LZ_demo_poc/helper_functions.py], destination: /home/user_name/lz_text_classification/

有谁能帮助我使用保存为bucket的数据在GCP上运行python脚本的过程。

您还需要指定要复制文件的实例,否则目标将被解释为本地文件,导致错误消息(第二行)。从示例中可以看出:

相反,可以将本地计算机上的文件复制到虚拟磁盘 机器:

$ gcloud compute scp ~/localtest.txt ~/localtest2.txt \
  example-instance:~/narnia
在您的情况下,应该是这样的:

gcloud compute scp /Users/abrahammathew/Desktop/LZ_demo_poc/helper_functions.py your_instance_name:/home/abraham_mathew/lz_text_classification/

您还需要指定要复制文件的实例,否则目标将被解释为本地文件,导致错误消息(第2行)。从示例中可以看出:

相反,可以将本地计算机上的文件复制到虚拟磁盘 机器:

$ gcloud compute scp ~/localtest.txt ~/localtest2.txt \
  example-instance:~/narnia
在您的情况下,应该是这样的:

gcloud compute scp /Users/abrahammathew/Desktop/LZ_demo_poc/helper_functions.py your_instance_name:/home/abraham_mathew/lz_text_classification/