Python can't find module 'clientsecrets

2019-04-16 19:05发布

问题:

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.