python3.11 无法安装 pycrypto

警告
本文最后更新于 2023-07-18,文中内容可能已过时。

安装 python3.11 的一个软件包 pycrypto 时,出现一个报错,导致无法安装相关依赖包。

/post/2023-07-18-python3.11-无法安装-pycrypto/pycrypto.png

根据这篇问答Could not build wheels for pycrypto, which is required to install pyproject.toml-based projects - ERROR

Try running pip install setuptools wheel before installing requirements.txt. Some legacy projects require these packages to build wheels for pyproject.toml based projects. If that doesn’t work, you might look into pycryptodome as a replacement for this dependency as mentioned in this thread.

这个看起来依然无效,然后找到文中提到的参考链接,提示有可能是 pycrypto 这个包年久失修,而 python3.11 又恰好更新了一些基础包(比如longint类型数据),从而导致安装报错。

前往链接:Failed installing pycrypto with pip

This is a workaround rather than a solution, but it is still useful, because according to this post on the “Issues” section of the pycrypto official repository, it seems the package has not been maintained at all in the last years. And their recommendation is to install pycryptodome instead, since it still creates a Crypto package with the same namespace, so it is expected to work with source code based on the pycrypto libraries.

1
2
pip uninstall pycrypto
pip install pycryptodome

可以在 github 上看到 pycrypto 确实已经停止更新了:Stop creating issues - this project is dead! #173

PyCrypto 2.x is unmaintained, obsolete, and contains security vulnerabilities. See https://www.pycrypto.org/ for details. The following is provided for historical/reference purposes only.

Move to a fork like pycryptodome

另外一个新项目是 cryptography

相关内容

william 支付宝支付宝
william 微信微信
0%