错误的python软件包版本:RequestsDependencyWarning:urllib3(1.7.1)或chardet(2.0.1)与支持的版本不匹配

时间:2019-03-22 17:38:09

标签: python version requirements.txt

我是python新手,我正在尝试运行https://github.com/epinna/tplmap

requirements.txt

PyYAML==3.12
certifi==2017.11.5
chardet==3.0.4
idna==2.6
requests==2.18.4
urllib3==1.22
wsgiref==0.1.2

从Github下载项目后,我运行sudo pip intall -r requirements.txt,当我尝试运行tplmap.py文件时,出现此错误

$ ./tplmap.py -u 'localhost:3000'
/usr/local/lib/python2.7/dist-packages/requests/__init__.py:80: RequestsDependencyWarning: urllib3 (1.7.1) or chardet (2.0.1) doesn't match a supported version!
      RequestsDependencyWarning)
    Traceback (most recent call last):
      File "./tplmap.py", line 3, in <module>
        from core import checks
      File "/home/amion/Desktop/tplmap-master/core/checks.py", line 20, in <module>
        from core.channel import Channel
      File "/home/amion/Desktop/tplmap-master/core/channel.py", line 1, in <module>
        import requests
      File "/usr/local/lib/python2.7/dist-packages/requests/__init__.py", line 90, in <module>
        from urllib3.exceptions import DependencyWarning
    ImportError: cannot import name DependencyWarning

我查看了/usr/local/lib/python2.7/dist-packages/requests/__init__.py文件并看到:

# urllib3 >= 1.21.1, <= 1.22
# chardet >= 3.0.2, < 3.1.0

如果我进行点冻结,我会看到:

chardet==3.0.4
requests==2.18.4
urllib3==1.22

我不明白此消息,这些版本号从何而来?我想念什么?

 RequestsDependencyWarning: urllib3 (1.7.1) or chardet (2.0.1) doesn't match a supported version!

1 个答案:

答案 0 :(得分:0)

我从/usr/lib/python2.7/dist-packages中删除了urlib3和chardet目录

然后,我从requirements.txt文件中卸载了所有需求,然后再次使用sudo并使用--user选项重新安装了它们。

cd /usr/lib/python2.7/dist-packages
sudo rm -r urllib3/
sudo rm -r chardet/

cd /home/amion/Desktop/tplmap-master
sudo pip uninstall -r requirements.txt 
pip install -r requirements.txt --user

看来tplmap.py尝试使用目录中的urllib3和chardet

/usr/lib/python2.7/dist-packages

而不是从目录

/usr/local/lib/python2.7/dist-packages