问题描述
许多 BigQuery 示例都以:
Lots of the BigQuery examples begin with:
import gcp.bigquery as bq
但是每当我尝试运行它时,我都会收到 ImportError: No module named gcp.bigquery
.
But I get ImportError: No module named gcp.bigquery
whenever I try to run this.
我如何安装这个库?
我正在使用 python 2.7 在 virtualenv 中工作.我试过 pip install gcp
、pip install gcloud
和 pip install google-api-python-client
.
I'm working in a virtualenv with python 2.7. I've tried pip install gcp
, pip install gcloud
, and pip install google-api-python-client
.
他们都没有帮助,我找不到任何文档.帮助!
None of them help and I can't find any documentation. Help!
更新:我想使用 gcp
的原因是我想从 Python 脚本中从 BigQuery 获取数据,最好是 CSV 格式.如果有更好的方法来做到这一点,我全神贯注......
UPDATE: the reason I want to use gcp
is that I want to get data from BigQuery, preferably in CSV form, from within a Python script. If there's a better way to do this, I'm all ears...
推荐答案
你应该尝试一个简单的:
You should try a simple:
$ pip install --upgrade google-api-python-client
如文档中所述.
此外,gcp.bigquery
是 Google Cloud DataLab,所以如果你仍然有兴趣,你应该从那个角度尝试.
Furthermore, gcp.bigquery
is part of Google Cloud DataLab, so you should try from that angle if you are still interested.
这篇关于如何在 Python 中安装 gcp?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!