Google AppEngine webapp2:导入bigquery时,没有名为pkg_resources的模块错误 [英] Google AppEngine webapp2: No module named pkg_resources error when importing bigquery
问题描述
我正在开发一个Web引擎应用程序,并希望连接到Google bigquery. 一切正常,直到我键入以下内容:
I am devolving a web engine app, and want to connect to Google bigquery. Everything works fine until I type the following:
from google.cloud import bigquery
如果我将此行放入.py文件并进行编译,则可以正常工作.它在我的应用文件夹中的main.py中不起作用.我的站点程序包中有pkg_resources文件夹,我不知道为什么. 下面是错误消息:
If I put this line in a .py file and compile it, it works perfectly fine. It is not working in the main.py in my app folder. My site-package has pkg_resources folder in it, I don't see why. Below are the error message:
这是app.yaml文件:
Here is the app.yaml file:
推荐答案
回溯表明您正在从本地计算机库而不是应用程序库中运行bigquery代码.
The traceback indicates you're running bigquery code from your local machine library, not from the app's library.
您需要将库供应到您的应用程序中.通过 App Engine 专用的BigQuery API客户端Python指令库:
You need to vendor the library into your application. From the App Engine specific BigQuery API Client Library for Python instructions:
因为Python客户端库未安装在 App中 引擎Python运行时环境,它们必须被供应到 您的应用程序就像第三方库一样.
Because the Python client libraries are not installed in the App Engine Python runtime environment, they must be vendored into your application just like third-party libraries.
这篇关于Google AppEngine webapp2:导入bigquery时,没有名为pkg_resources的模块错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!