Python 2.7导入请求问题

时间:2018-03-20 20:58:58

标签: python python-2.7 python-requests urllib3

我试图通过pip install requests命令安装请求模块(Debian,Python 2.7)。输出是:

Installing collected packages: urllib3, requests
Successfully installed requests-2.18.4 urllib3-1.22

尝试遵循以下Quickstart tutorial但我在import requests

时收到以下错误
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "requests/__init__.py", line 76, in <module>
    check_compatibility(urllib3.__version__, chardet.__version__)
AttributeError: 'module' object has no attribute '__version__'

任何帮助?

1 个答案:

答案 0 :(得分:0)

问题在于chardet包。卸载它(pip uninstall chardet)并再次安装,现在它可以正常工作。干杯!