尝试安装python-social-auth,获取ImportError:没有名为' requests.packages'

时间:2015-10-02 17:20:33

标签: python django

问题标题说明了一切。我不是Python专家,不知道从哪里开始。我尝试了我能想到的一切。

我使用pip3和python3与Django 1.8。

按照https://github.com/omab/python-social-auth的说明,我做了sudo pip3 install python-social-auth以及所有依赖项。

Shell输出:

$ python3 manage.py shell
Traceback (most recent call last):
  File "./manage.py", line 10, in <module>
    execute_from_command_line(sys.argv)
  File "/usr/local/lib/python3.4/dist-packages/django/core/management/__init__.py", line 338, in execute_from_command_line
    utility.execute()
  File "/usr/local/lib/python3.4/dist-packages/django/core/management/__init__.py", line 312, in execute
    django.setup()
  File "/usr/local/lib/python3.4/dist-packages/django/__init__.py", line 18, in setup
    apps.populate(settings.INSTALLED_APPS)
  File "/usr/local/lib/python3.4/dist-packages/django/apps/registry.py", line 108, in populate
    app_config.import_models(all_models)
  File "/usr/local/lib/python3.4/dist-packages/django/apps/config.py", line 198, in import_models
    self.models_module = import_module(models_module_name)
  File "/usr/lib/python3.4/importlib/__init__.py", line 109, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 2254, in _gcd_import
  File "<frozen importlib._bootstrap>", line 2237, in _find_and_load
  File "<frozen importlib._bootstrap>", line 2226, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 1200, in _load_unlocked
  File "<frozen importlib._bootstrap>", line 1129, in _exec
  File "<frozen importlib._bootstrap>", line 1471, in exec_module
  File "<frozen importlib._bootstrap>", line 321, in _call_with_frames_removed
  File "/usr/local/lib/python3.4/dist-packages/social/apps/django_app/default/models.py", line 8, in <module>
    from social.utils import setting_name
  File "/usr/local/lib/python3.4/dist-packages/social/utils.py", line 13, in <module>
    from requests.packages.urllib3.poolmanager import PoolManager
ImportError: No module named 'requests.packages'

我不确定为什么python-social-auth模块会尝试调用requests.packages,因为这似乎并不存在于&#34;请求&#34;模块。

2 个答案:

答案 0 :(得分:1)

我解决了自己的问题。

sudo pip3 install requests --upgrade

通过升级系统的“请求”包来修复它。

答案 1 :(得分:1)

这个问题可能会引起一大批新访问者......

requests.packages已从请求中删除: https://github.com/kennethreitz/requests/pull/4067

单独安装vendored库

pip install urllib3