英文:
How do I solve the there is no Crypto package error in Python?
问题
I am having an error in my Python code, basically I need to import the package Crypto and I have tried to download it, it says that the package crypto has been installed then keeps showing the same error. I have tried to rename the package from crypto to Crypto but it shows again the same error. Can you please help me how to solve this error or is there any alternative package. Thank you
我在我的Python代码中遇到了一个错误,基本上我需要导入Crypto包,但我已经尝试下载它,它说Crypto包已安装,然后一直显示相同的错误。我尝试将包名从crypto改为Crypto,但仍然显示相同的错误。您能帮助我解决这个错误吗,或者是否有替代包可用。谢谢
I tried to import DES and RSA from the cryto library but I can not properly download the package Crypto.
我尝试从cryto库导入DES和RSA,但我无法正确下载Crypto包。
edit: I tried to install from the terminal: pip install Crypto also directly proposed by intelliJ, the code that i'm trying is
编辑:我尝试从终端安装:pip install Crypto,还有IntelliJ直接提供的方式,我正在尝试的代码是
from Crypto.Cipher import DES
from Crypto.PublicKey import RSA
英文:
I am having an error in my Python code, basically I need to import the package Crypto and I have tried to download it, it says that the package crypto has been installed then keeps showing the same error. I have tried to rename the package from crypto to Crypto but it shows again the same error. Can you please help me how to solve this error or is there any alternative package. Thank you
I tried to import DES and RSA from the cryto library but I can not properly download the package Crypto.
edit: I tried to install from the terminal: pip install Crypto also directly proposed by intelliJ, the code that i'm trying is
from Crypto.Cipher import DES
from Crypto.PublicKey import RSA
答案1
得分: 1
你应该安装的包名为 pycryptodome
,请尝试安装:
pip install pycryptodome
由于它在某种程度上依赖于系统库,所以可能会出现问题。为了解决这个问题,创建了一个名为 pycryptodomex
的库,其中包含了所有依赖项,你可以使用以下命令进行安装:
pip install pycryptodomex
但在使用它时,你需要使用以下修改后的原始代码:
from Cryptodome.Cipher import DES
from Cryptodome.PublicKey import RSA
英文:
The package you shall install is called pycryptodome
, so try installing
pip install pycryptodome
It is somehow dependent on system libraries so it might evantually get broken. To fix this was created pycryptodomex
library that has everything bundled in, which you install using
pip install pycryptodomex
But then instead of your original code you need to use
from Cryptodome.Cipher import DES
from Cryptodome.PublicKey import RSA
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论