I'm having issue with accessing Google Storage through Python 3.6.I'm installing with:
pip install --upgrade google-cloud-storage
Here's my Python script:
from google.cloud import storage
def main():
client = storage.Client()
bucket = client.get_bucket('my_bucket')
blob1 = bucket.blob('my_file.json')
blob1.upload_from_filename(filename='my_file.json')
if __name__ == "__main__":
main()
pip show google-cloud-storage
gives me following output:
Name: google-cloud-storage
Version: 1.6.0
Summary: Python Client for Google Cloud Storage
Home-page: https://github.com/GoogleCloudPlatform/google-cloud-python
Author: Google Cloud Platform
Author-email: [email protected]
License: Apache 2.0
Location: /usr/local/lib/python3.6/dist-packages
Requires: google-api-core, google-auth, google-cloud-core, requests, google-resumable-media
Any idea what's wrong here?
To solve the Python "ModuleNotFoundError: No module named 'google. cloud'" error, install the specific google cloud module that you are importing, e.g. pip install google-cloud-speech if importing speech or pip install google-cloud-storage if importing storage .
There is a chance you are installing it with one python
version (E.g. python2
) and running your code with another version (E.g. python3
).
Try mentioning versions of pip
and python
in the command.
To be precise, use pip of the python version you wanna run the code with. Example:
python3.6 -m pip install --upgrade google-cloud-storage
There could be multiple versions of Python installed on your system and multiple versions of pip
as well, the above will make sure you are using the correct version of both.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With