Python can't find module 'clientsecrets' when trying to set up oauth2 in Django using the Google Python API

家住魔仙堡 提交于 2019-12-06 12:19:00

问题


I installed the Google APIs Client Library for Python on my Windows 7 box using pip. I am following the Django example that Google provides, but I can't start my server because Python throws an ImportError: No module named 'clientsecrets'.

I have verified that clientsecrets.py is located in /path/to/python/Lib/site-packages.

Any idea what could be causing this? I am using Python version 3.3.3 and Django version 1.6.1


回答1:


I've changed in /usr/lib/python3/dist-packages/oauth2client/client.py the line:

  22 import base64
  23 import clientsecrets
  24 import copy

to this:

  22 import base64
  23 import oauth2client.clientsecrets
  24 import copy

and then that solved that problem. This problem came only with Python 3, with Python 2.7 that worked out of box.



来源:https://stackoverflow.com/questions/21521055/python-cant-find-module-clientsecrets-when-trying-to-set-up-oauth2-in-django

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!