本文介绍了当使用Google Python API在Django中设置oauth2时,Python找不到模块'customersecrets'的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用在我的 Windows 7 框中安装了 Google API客户端库Python PIP 。我遵循Google提供的Django示例,但是我无法启动我的服务器,因为Python抛出一个 ImportError:没有名为'clientsecrets'的模块



我已经验证 clientsecrets.py 位于 / path / to / python / Lib / site-packages



任何想法可能导致这个?我使用 Python版本3.3.3 Django版本1.6.1

解决方案

我已经在/usr/lib/python3/dist-packages/oauth2client/client.py 中更改了

  22 import base64 
23 import clientsecrets
24 import copy
pre>

到:

  22 import base64 
23 import oauth2client.clientsecrets
24 import copy

然后解决了这个问题。这个问题只出现在Python 3中,Python 2.7是开箱即用的。


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

解决方案

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.

这篇关于当使用Google Python API在Django中设置oauth2时,Python找不到模块'customersecrets'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-14 16:59