Solve the code error problem of scrapy framework command execution (scrapy crawl xx)

Running the code after installing the scrapy2.5 version may encounter the following errors:

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

Why is this error reported?
Check the official documentation: https://pypi.org/project/pyOpenSSL/
found that SSLv2 and SSLv3 are no longer supported after version 22.0.0
insert image description here

The solution is to lower the version:pip install pyOpenSSL==22.0.0

After lowering the pyOpenSSL version, the following error is still reported.
The reason is that the cryptography version is too high. OpenSSL is not supported after version 38.0.4.
Official changelog documentation: https://cryptography.io/en/latest/changelog/
insert image description here

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

Lower the cryptography version:pip install cryptography==38.0.4

After completing the above two steps, scrapy can execute the code normally.

Guess you like

Origin blog.csdn.net/qq_69218005/article/details/131772512