Python 2.7.3 urllib2错误

时间:2016-06-21 01:09:15

标签: python

当我尝试运行我的python脚本时,会发生此错误。我该如何解决这个问题?

['__builtins__', '__doc__', '__file__', '__name__', '__package__', 'urllib2']
Traceback (most recent call last):
  File "m.py", line 3, in <module>
    import requests
  File "/usr/local/lib/python2.7/dist-packages/requests-2.9.1-py2.7.egg/requests/__init__.py", line 58, in <module>
    from . import utils
  File "/usr/local/lib/python2.7/dist-packages/requests-2.9.1-py2.7.egg/requests/utils.py", line 26, in <module>
    from .compat import parse_http_list as _parse_list_header
  File "/usr/local/lib/python2.7/dist-packages/requests-2.9.1-py2.7.egg/requests/compat.py", line 38, in <module>
    from urllib2 import parse_http_list
ImportError: cannot import name parse_http_list

1 个答案:

答案 0 :(得分:2)

您需要升级requests

pip install --upgrade requests