解决scrapy框架命令执行(scrapy crawl xx)代码报错问题

安装scrapy2.5版本之后运行代码可能会遇到以下错误:

AttributeError: module 'OpenSSL.SSL' has no attribute 'SSLv3_METHOD'

为什么会报这个错误呢?
查看官方文档:https://pypi.org/project/pyOpenSSL/
发现在22.0.0版本以后就不再支持SSLv2 和 SSLv3
在这里插入图片描述

解决办法降低版本:pip install pyOpenSSL==22.0.0

在降低pyOpenSSL版本后仍报以下错误
原因仍然是cryptography版本太高,在38.0.4版本以后,不支持OpenSSL 。
官方更新日志文档:https://cryptography.io/en/latest/changelog/
在这里插入图片描述

AttributeError: module 'lib' has no attribute 'OpenSSL_add_all_algorithms'

降低cryptography版本:pip install cryptography==38.0.4

完成以上两步以后scrapy就可以正常执行代码了。

猜你喜欢

转载自blog.csdn.net/qq_69218005/article/details/131772512