简体   繁体   English

如何在谷歌云function中运行exe文件?

[英]How to run an exe file in google cloud function?

I have a windows executable file(net_audio_client.exe) on my local machine.我的本地机器上有一个 windows 可执行文件(net_audio_client.exe)。 It works fine when I run the below's python code on my pycharm IDE.当我在我的 pycharm IDE 上运行以下 python 代码时,它工作正常。

def hello_world(request):
    request_json = request.get_json()
    if request.args and 'message' in request.args:
        return request.args.get('message')
    elif request_json and 'message' in request_json:
        return request_json['message']
    else:
        print(subprocess.Popen("net_audio_client -user xxx -pass xxx -mac macaddr", shell=True,
                               stdout=subprocess.PIPE).stdout.read())
        return f'Hello World!'

The same code doesn't work when I zip it and upload it to the google cloud function.当我 zip 并将其上传到谷歌云 function 时,相同的代码不起作用。 I get the following errors:我收到以下错误:

/bin/sh: 1: net_audio_client: not found

The stack questions that I followed:我遵循的堆栈问题:

  1. How to load local assets within a GCP cloud function? 如何在 GCP 云 function 中加载本地资产?
  2. How to run a subprocess inside Google Cloud Function? 如何在 Google Cloud Function 中运行子进程?

Thanks谢谢

Cloud Functions, Cloud Run and App Engine support only Linux runtime. Cloud Functions、Cloud Run 和 App Engine 仅支持 Linux 运行时。 You can't run Windows binary on them.您不能在它们上运行 Windows 二进制文件。

You can deploy a GKE Cluster with Windows if you want to use container and your windows binary.如果您想使用容器和 windows 二进制文件,可以使用 Windows 部署 GKE 集群。 Or directly a Compute Engine.或者直接使用 Compute Engine。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM