简体   繁体   English

在 Azure 函数中导入 Google Cloud python 库时出错

[英]Error importing Google Cloud python library in Azure Functions

I have Python code that I used to develop an Azure Function App, and the code involves me importing the google-cloud-bigquery library.我有 Python 代码,用于开发 Azure Function 应用程序,代码涉及我导入google-cloud-bigquery库。 I have a list of requirements.txt in the project folder with the libraries mentioned.我在项目文件夹中有一个 requirements.txt 列表,其中包含提到的库。 Now I have tried importing it, in both the following ways:现在我尝试通过以下两种方式导入它:

import google.cloud.bigquery
import google.oauth2.service_account

and

from google.cloud import bigquery
from google.oauth2 import service_account

but I get an error:但我收到一个错误:

Exception while executing function: Functions.test_function <--- Result: Failure Exception: ModuleNotFoundError: No module named 'google.cloud' Stack: File "/usr/local/lib/python3.6/site-packages/azure_functions_worker/dispatcher.py", line 239, in _handle__function_load_request执行 function 时出现异常:Functions.test_function <--- 结果:失败异常:ModuleNotFoundError: No module named 'google.cloud' Stack: File "/usr/local/lib/python3.6/site-packages/azure_functions_worker/dispatcher. py”,第 239 行,在 _handle__function_load_request 中

Can someone tell me how to use external Python libraries in Azure Functions (Dynamic-Consumption Plan on a Linux machine)?有人能告诉我如何在 Azure 函数(Linux 机器上的动态消耗计划)中使用外部 Python 库吗?

requirements.txt looks like this: requirements.txt看起来像这样:

google-cloud-bigquery
google-cloud-bigquery[pandas]
pandas-gbq
azure
azure-cosmos

Azure Functions are primarily for serverless compute. Azure 函数主要用于无服务器计算。 Installing Python libraries permanently is not supported.不支持永久安装 Python 库。

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

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