爬虫过程中遇到的问题

JJJhr'blog / 2024-04-27 / 原文

ERROR: THESE PACKAGES DO NOT MATCH THE HASHES FROM THE REQUIREMENTS FILE. If you have updated the package versions, please update the hashes. Otherwise, examine the package contents carefully; someone may have tampered with them.
pysocks!=1.5.7,<2.0,>=1.5.6 from https://mirrors.cloud.tencent.com/pypi/packages/8d/59/b4572118e098ac8e46e399a1dd0f2d85403ce8bbaad9ec79373ed6badaf9/PySocks-1.7.1-py3-none-any.whl#sha256=2725bd0a9925919b9b51739eea5f9e2bae91e83288108a9ad338b2e3a4435ee5 (from urllib3[socks]<3,>=1.26->selenium):
Expected sha256 2725bd0a9925919b9b51739eea5f9e2bae91e83288108a9ad338b2e3a4435ee5
Got e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855

 

这个错误通常发生在使用Python的包管理工具pip安装依赖时,当pip尝试从指定的源下载并安装包,但是下载的包的哈希值与requirements文件中提供的哈希值不匹配时。这可能是由于下载的包已被篡改或损坏,或者网络问题导致下载的包与源上的包不一致。

解决方法:清除pip缓存:使用命令 pip cache purge 清除缓存,然后重新尝试安装。