RequestsDependencyWarning:urllib3(1.25.2)或chardet(3.0.4)与支持的版本不匹配!固定

时间:2019-05-15 18:29:56

标签: python pip importerror archlinux

每当我运行带有请求的代码或进行pip安装时,都会收到此消息

/usr/lib/python2.7/site-packages/requests/__init__.py:91: RequestsDependencyWarning: urllib3 (1.25.2) or chardet (3.0.4) doesn't match a supported version!
  RequestsDependencyWarning)

我尝试升级chardet,urllib3和请求,但没有任何效果,有人知道我该如何解决?

编辑:RequestsDependencyWarning: urllib3 (1.9.1) or chardet (2.3.0) doesn't match a supported version <-这不能解决我的问题。

7 个答案:

答案 0 :(得分:7)

解决此问题的正确命令是:

pip3 install --upgrade requests

我从2.21.0升级到2.24.0,错误消失了。

答案 1 :(得分:4)

我用

修复它
pip install --upgrade requests

答案 2 :(得分:1)

仅需升级请求

  pip3 install requests

答案 3 :(得分:1)

我通过

解决了这个问题
pip install --upgrade requests==2.20.1

如果看到如下所示的版本不兼容消息,则应尝试其他版本。所有版本均为:here

ERROR: docker-compose 1.24.1 has requirement requests!=2.11.0,!=2.12.2,!=2.18.0,<2.21,>=2.6.1, but you'll have requests 2.21.0 which is incompatible.

答案 4 :(得分:0)

当我尝试运行docker-compose时遇到了这个问题: urllib3(1.24.1)或chardet(3.0.4)与支持的版本不匹配

就我而言,我通过移除docker-compose解决了此问题:

sudo apt-get remove docker-compose

并安装:

sudo curl -L "https://github.com/docker/compose/releases/download/1.24.0/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose

答案 5 :(得分:0)

就我而言,升级请求无效。 pip3 install requests

我使用ehh's solution重新下载docker-compose

sudo curl -L "https://github.com/docker/compose/releases/download/1.24.0/docker-compose-$(uname -s)-$(uname -m)" -o /usr/bin/docker-compose

然后通过以下方式向文件添加执行功能 sudo chmod +x /usr/bin/docker-compose

答案 6 :(得分:0)

找到并查看requests/init.py源文件:

def check_compatibility(urllib3_version, chardet_version):
    urllib3_version = urllib3_version.split('.')
    assert urllib3_version != ['dev']  # Verify urllib3 isn't installed from git.

    # Sometimes, urllib3 only reports its version as 16.1.
    if len(urllib3_version) == 2:
        urllib3_version.append('0')

        # Check urllib3 for compatibility.
        major, minor, patch = urllib3_version  # noqa: F811
        major, minor, patch = int(major), int(minor), int(patch)
        # urllib3 >= 1.21.1, <= 1.24    !HERE!
        assert major == 1
        assert minor >= 21
        assert minor <= 24

        # Check chardet for compatibility.
        major, minor, patch = chardet_version.split('.')[:3]
        major, minor, patch = int(major), int(minor), int(patch)
        # chardet >= 3.0.2, < 3.1.0    !HERE!
        assert major == 3
        assert minor < 1
        assert patch >= 2