No module named 'Crypto'的解决方案
文章目录
问题
使用Crypto库时出现No module named 'Crypto'。
Crypto的依赖库
pip install pycryptodome
pip install crypto
pip install pycrypto我的python版本是3.7,使用pip install pycrypto命令时报错:
C:\Users\MI\AppData\Local\Programs\Python\Python37>Pip3.7 install pycrypto
Collecting pycrypto
Using cached pycrypto-2.6.1.tar.gz (446 kB)
Using legacy 'setup.py install' for pycrypto, since package 'wheel' is not installed.
Installing collected packages: pycrypto
Running setup.py install for pycrypto ... error
ERROR: Command errored out with exit status 1:
command: 'c:\users\mi\appdata\local\programs\python\python37\python37.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\MI\\AppData\\Local\\Temp\\pip-install-iwoi68sx\\pycrypto_11418f0350244305b0226b38fc392f84\\setup.py'"'"'; __file__='"'"'C:\\Users\\MI\\AppData\\Local\\Temp\\pip-install-iwoi68sx\\pycrypto_11418f0350244305b0226b38fc392f84\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\MI\AppData\Local\Temp\pip-record-8g35bcmi\install-record.txt' --single-version-externally-managed --compile --install-headers 'c:\users\mi\appdata\local\programs\python\python37\Include\pycrypto'报错原因
pycrypto、pycrytodome和crypto是一个东西,crypto在python上面的名字是pycrypto,它是一个第三方库,但是已经停止更新三年了。
解决方法
使用
pip命令安装以下依赖库,无视报错:pip install pycryptodome pip install crypto pip install pycrypto- 打开
\Python\Python37\Lib\site-packages这个路径,找到crypto这个文件夹。 - 将
crypto这个文件夹重命名为Crypto。 - 重新运行程序即可发现
No module named 'Crypto'报错消失。
评论
登录后参与技术讨论,分享你的经验与见解。
登录 / 注册暂无评论