简体   繁体   English

如何在 pycharm 中安装 pycrypto?

[英]How to install pycrypto in pycharm?

I want to use "from Crypto.Cipher import AES" in pycahrm for running the AES encryption and decryption code.我想在 pycahrm 中使用“from Crypto.Cipher import AES”来运行 AES 加密和解密代码。 But when I want to install pycrypto or pycryptodome, the terminal shows this message:但是当我想安装 pycrypto 或 pycryptodome 时,终端会显示此消息:

Command "python setup.py egg_info" failed with error code 1 in C:\Users\....\AppData\Local\Temp\pip-install-6gk6aq_f\pycryptodome

How can I install these packages?如何安装这些软件包?

It looks like there's a problem in the version of pycrypto/pycryptodome that you're installing.您正在安装的 pycrypto/pycryptodome 版本似乎存在问题。 The lines prior to the one in your question should contain details about what this is.您问题中的那一行之前的行应该包含有关这是什么的详细信息。 It could be that this distribution doesn't work on windows, doesn't specify all the dependencies it needs or one of many other problems.可能是此发行版不适用于 windows,未指定所需的所有依赖项或许多其他问题之一。 If you can post the entire error we should be able to give more advice.如果您可以发布整个错误,我们应该能够提供更多建议。

You could try installing an early version to see if that works, the current version of pycryptodome is 3.10.1 so try pip install pycryptodome==3.9.9 which is the previous version in PyPI.您可以尝试安装早期版本以查看是否有效,pycryptodome 的当前版本是 3.10.1,因此请尝试pip install pycryptodome==3.9.9 ,这是 PyPI 中的先前版本。

Another thing you can do is install the distribution a different way.您可以做的另一件事是以不同的方式安装发行版。 Try downloading the.tar.gz archive of the package and pip installing that file eg pip install pycryptodome-3.10.1.tar.gz尝试下载 package 和 pip 的 .tar.gz 存档,安装该文件,例如pip install pycryptodome-3.10.1.tar.gz

Both of these solutions may work but it's impossible to say without knowing the precise problem with the install.这两种解决方案都可能有效,但如果不知道安装的确切问题,就不可能说出来。


On pycrypto github there seem to be a lot of installation problems and the recommendation is) to use pycryptodome instead.在 pycrypto github上似乎存在很多安装问题,建议使用 pycryptodome 代替。

Pycharm -> Preference -> Project -> Python Interpreter -> + pycryptodome. Pycharm -> 首选项 -> 项目 -> Python 解释器 -> + pycryptodome。 Since pycrypto hasn't maintained for years, install pycryptodome instead.由于 pycrypto 多年未维护,请安装pycryptodome

在此处输入图像描述

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM