许多 BigQuery 示例以:
import gcp.bigquery as bq
但是每当我尝试运行它时,我都会得到 ImportError: No module named gcp.bigquery
。
如何安装这个库?
我正在使用 python 2.7 在 virtualenv 中工作。我试过 pip install gcp
、pip install gcloud
和 pip install google-api-python-client
。
它们都没有帮助,我找不到任何文档。帮助!
更新:我想使用 gcp
的原因是我想从 BigQuery 获取数据,最好是 CSV 格式,从 Python 脚本中获取。如果有更好的方法来做到这一点,我会洗耳恭听......
最佳答案
使用 pandas 和 google-api-python-client。您正在寻找的功能是 pd.read_gbq http://pandas.pydata.org/pandas-docs/stable/generated/pandas.io.gbq.read_gbq.html
关于python - 如何在 Python 中安装 gcp?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34859009/