PyCharm IDE 不会从 Crypto.Cipher 导入 AES 加载

PyCharm IDE will not load from Crypto.Cipher import AES

我可以 运行 python3 myfile.py 在 MAC OS 命令行上,它工作正常,但在 IDE 中,我收到以下错误。我已经完成了

pip uninstall pycrypto
pip install pycrypto

这在 PyCharm IDE 中没有效果,但它确实适用于命令行。

Python是3.7内外IDE。 pycrypto 通过 Preferences -> Project -> Project Interpreter 安装。 pycrpto的版本是2.6.1.

我错过了什么?

    /Users/denisputnam/git/kingslanding/venv/bin/python /Users/denisputnam/git/kingslanding/denisputnam-cryptography-overview-exercise/mysymmetricencryptiondecryption.py
Traceback (most recent call last):
  File "/Users/denisputnam/git/kingslanding/denisputnam-cryptography-overview-exercise/mysymmetricencryptiondecryption.py", line 4, in <module>
    from Crypto.Cipher import AES 
ModuleNotFoundError: No module named 'Crypto'

Process finished with exit code 1

查看以下内容troubleshooting page

根据您的控制台输出,您需要从系统终端 运行 /Users/denisputnam/git/kingslanding/venv/bin/python /Users/denisputnam/git/kingslanding/denisputnam-cryptography-overview-exercise/mysymmetricencryptiondecryption.py 看看它是否有效。

你应该使用 pycryptodome。

在此处查看文档:pycryptodome docs

由于您安装了其他可能会干扰的模块(通常是开发人员错误地安装了 crypto),您可能需要卸载所有不相关的模块,然后再安装 pycryptodome。

请参阅我对 Another similar question 的回答,其中包含有关正确卸载和重新安装的详细信息:

pip uninstall crypto
pip uninstall pycryptodome
pip install pycryptodome