简体   繁体   中英

ModuleNotFoundError when trying to use BigQuery from google.cloud

So when I run my import statement in my python script, I'd get a ModuleNotFoundError.

    from google.cloud import bigquery
ModuleNotFoundError: No module named 'google'

I've been following https://www.getcensus.com/blog/how-to-hack-it-extracting-data-from-google-bigquery-with-python-2 and I've ran a

pip install --upgrade google-cloud-bigquery

which still hasn't worked

I've tried installing a few other packages from google, but nothing has worked so far.

You have to create a virtual env in your current project, then install the following package with pip :

requirements.txt file

google-api-python-client==2.70.0

In your virtual env, run the following command:

pip install -r requirements.txt

Then you will be able to import the expected elements from the library:

from google.cloud import bigquery

Check your Python version and use Python 3 .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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