Skip to main content
 首页 » 编程设计

python之导入 _counter 形式的 pycrypto 库时出错

2025年05月04日9itcoder

pycrypto 库中 Crypto/Util/Counter.py 中的这一行:

from Crypto.Util import _counter 

导致此错误:

ImportError: cannot import name _counter 

但我在 Python 站点包的 pycrypto 库中的 Crypto/Util 下有文件 _counter.so。我正在使用适用于 Windows 的 Python 2.7.5,32 位。

请您参考如下方法:

文件 _counter.so 属于 Linux/MacOS 包,Windows 应该有 _counter.pyd 代替。可以从这里下载预构建的 Windows PyCrypto 包:http://www.voidspace.org.uk/python/modules.shtml#pycrypto