Python3.8 installs Crypto three-party library

Local python version: python3.8

problem scenario

1. Import the interface automation script written by other members of the team to local debugging. When you see the Crypto library (capital C), you must directly execute the result of pip install Crypto. After the installation is complete, re-execute the code, but it still prompts that the Crypto library cannot be found
.
After searching for a long time, I found that the installed library displayed crypto (lowercase c), found the installation directory, and the folder name was also crypto (lowercase c).
2. So, I renamed the folder crypto to Crypto, and executed the script again. This time, an error was reported: ModuleNotFoundError: No module named 'Crypto.Cipher'
insert image description here
3. Now I won't do it anymore. I checked the information online, Followed the operation, I didn't expect to solve it easily:

solution

1. After executing pip uninstall crypto pycryptodome
, you will find that the Crypto folder in the installation directory has been deleted (that is, the folder where we changed the lowercase c to uppercase C earlier) 2. Then execute
pip install pycryptodome
and find that the Crypto file The folder is back again, this time it is directly capital C
3. Re-execute my script, this time no error is reported and it is successful.

References: Explain why the Crypto module is so "skinned"? No module named “Crypto”
In the document I refer to, the author also explained the principle of the uppercase and lowercase c, as well as the normal installation method (the remedial measures after the installation error that I belonged to above), if you are interested, you can see Down.

Guess you like

Origin blog.csdn.net/weixin_48415452/article/details/126464422