2019年5月15日 星期三

[python] 解決 ImportError: No module named apiclient.discovery from oauth2client.client import SignedJwtAssertionCredentials ImportError: No module named oauth2client.client


[python] 解決 ImportError: No module named apiclient.discovery from oauth2client.client import SignedJwtAssertionCredentials ImportError: No module named oauth2client.client

± % python cron_ga_fetcher.py           
Traceback (most recent call last):
  File "cron_ga_fetcher.py", line 12, in <module>
    from apiclient.discovery import build
ImportError: No module named apiclient.discovery

% pip install --upgrade google-api-python-client

====

Traceback (most recent call last):
  File "/usr/bin/pip", line 9, in <module>
    from pip import main
  File "/usr/lib/python2.7/dist-packages/pip/__init__.py", line 24, in <module>
    from urllib3.exceptions import DependencyWarning
ImportError: cannot import name DependencyWarning

% pip install --upgrade requests

====

Traceback (most recent call last):
  File "cron_ga_fetcher.py", line 13, in <module>
    from oauth2client.client import SignedJwtAssertionCredentials
ImportError: No module named oauth2client.client

% pip install oauth2client==1.5.2


寫入 requirements.txt 中
google-api-python-client
oauth2client==1.5.2
requests

沒有留言:

張貼留言