无法导入名称 SIGNATURE_HMAC
我正在运行一个叫做 django 示例 的项目,这个项目是由 python-social-auth 提供的,但我遇到了一个500服务器错误。
ImportError at /login/bitbucket/
cannot import name SIGNATURE_HMAC
Request Method: GET
Request URL: http://localhost:8000/login/bitbucket/
Django Version: 1.4.4
Exception Type: ImportError
Exception Value:
cannot import name SIGNATURE_HMAC
Exception Location: /usr/local/lib/python2.7/dist-packages/requests_oauthlib/core.py in <module>, line 3
Python Executable: /usr/bin/python
Python Version: 2.7.3
我在谷歌和StackOverflow上搜索过,但没有找到任何解决办法。我只是克隆了这个项目,没有改动任何代码。我已经安装了hashlib和hmac这两个库。
[编辑] 我升级了oauthlib和requests_oauthlib这两个库,结果错误变成了一个新的错误。
AttributeError at /login/bitbucket/
'Request' object has no attribute 'body'
Request Method: GET
Request URL: http://localhost:8000/login/bitbucket/
Django Version: 1.4.4
Exception Type: AttributeError
Exception Value:
'Request' object has no attribute 'body'
Exception Location: /usr/local/lib/python2.7/dist-packages/requests_oauthlib/core.py in __call__, line 46
Python Executable: /usr/bin/python
Python Version: 2.7.3
1 个回答
0
为了参考,我通过使用pip重新安装oauthlib这个包解决了标题中的问题(这个问题是从谷歌找到的)。
sudo pip install --upgrade oauthlib
因为这个问题,我无法打开Ubuntu软件中心,升级了oauthlib之后,一切都正常了。