使用SDK在Google云中设置环境变量时出错

2024-05-20 21:28:11 发布

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

我正试图在Google云上为我的Django应用程序设置环境变量。 我在SDK上输入了以下内容:

gcloud functions deploy env_vars --runtime python37 --set-env-vars SUBSCRIPTION_KEY=1234567890 --trigger-http

返回的错误是:

ERROR: (gcloud.functions.deploy) OperationError: code=3, message=Build failed: {"error": {"canonicalCode": "INTERNAL", "errorMessage": "`pip_install_from_wheels` had stderr output:\n/opt/python3.7/bin/python3.7: No module named pip\n\nerror: `pip_install_from_wheels` returned code: 1", "errorType": "InternalError", "errorId": "ECB5F712"}}

请帮忙。你知道吗

我的requirements.txt文件:

Django==2.2.5
Pillow==6.2.1
azure-cognitiveservices-language-textanalytics==0.2.0
azure-cognitiveservices-nspkg==3.0.1
azure-cognitiveservices-search-newssearch==1.0.0 
azure-cognitiveservices-search-nspkg==3.0.1
azure-common==1.1.23
azure-nspkg==3.0.2
msrest==0.6.10
numpy==1.17.1
oauthlib==3.1.0
pandas==0.24.2
pandas-datareader==0.7.4
pip==19.0.3
requests==2.21.0
setuptools==40.8.0
sqlparse==0.3.0
statistics==1.0.3.5
ta==0.4.5
gunicorn==20.0.4

Tags: installpipdjangofromenvservicecodevars
1条回答
网友
1楼 · 发布于 2024-05-20 21:28:11

你的pip中有requirements.txt,可能是因为你做了类似pip freeze all > requirements.txt的事情。python3.7云函数运行时有一个bug,将pip指定为函数的依赖项会导致此问题。你知道吗

您应该从requirements.txt文件中删除pip,但也要确保只指定实际依赖于函数的需求。你知道吗

相关问题 更多 >