How to prevent “ImportError: No module named oauth2client.client” on Google App Engine?

后端 未结 5 1536
没有蜡笔的小新
没有蜡笔的小新 2020-12-05 04:11

We are receiving an error:

ImportError: No module named OAuth2Client

We have noticed scores of questions around this topic, many

相关标签:
5条回答
  • 2020-12-05 04:42

    Install WHL file

    pip install oauth2client-4.1.3-py2.py3-none-any.whl
    
    0 讨论(0)
  • 2020-12-05 04:44

    As per the google-api-python documentation, try this

    pip install --upgrade google-api-python-client oauth2client
    
    0 讨论(0)
  • 2020-12-05 04:58

    Run this

    sudo python -m pip install oauth2client

    0 讨论(0)
  • 2020-12-05 05:02

    I have this problem and solved by installing oauth2client with pip3:

    pip3 install --upgrade oauth2client 
    
    0 讨论(0)
  • 2020-12-05 05:02

    The answer is to "vendor" in the file(s).

    We found a quick way to solve this based on this documentation https://cloud.google.com/appengine/docs/python/tools/libraries27#vendoring and this SO answer.

    1. Create a new folder called "lib" in the same folder as your app.yaml file. (You can name it something else. Just use that name below.)

    2. Create an empty file called appengine_config.py in the same folder as your app.yaml file

    3. Add two lines to that appengine_config.py file:

      from google.appengine.ext import vendor vendor.add('lib')

    4. From terminal, navigate to the directory which contains that file and execute the following command:

      sudo pip install -t lib google-api-python-client

    The import error will disappear and you will have all the sub-dependent modules as well.

    0 讨论(0)
提交回复
热议问题