Pip:

陌路散爱 提交于 2020-11-15 04:02:51

Crypto 库异常

    from Crypto.Cipher import AES
  File "/root/www/Mkilometers/app/env/lib/python3.7/site-packages/Crypto/Cipher/__init__.py", line 27, in <module>
    from Crypto.Cipher._mode_ecb import _create_ecb_cipher
  File "/root/www/Mkilometers/app/env/lib/python3.7/site-packages/Crypto/Cipher/_mode_ecb.py", line 29, in <module>
    from Crypto.Util._raw_api import (load_pycryptodome_raw_lib,
  File "/root/www/Mkilometers/app/env/lib/python3.7/site-packages/Crypto/Util/_raw_api.py", line 33, in <module>
    from Crypto.Util.py3compat import byte_string
ImportError: cannot import name 'byte_string' from 'Crypto.Util.py3compat' (/root/www/Mkilometers/app/env/lib/python3.7/site-packages/Crypto/Util/py3compat.py)
(env) root@localhost:~/www/Mkilometers/app#

原因

(env) root@localhost:~/www/Mkilometers/app# pip list | grep pycrypto
pycrypto                  2.6.1
pycryptodome              3.9.4
WARNING: You are using pip version 19.2.3, however version 20.2.4 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
(env) root@localhost:~/www/Mkilometers/app#

解决办法

pip3 uninstall pycrypto
pip3 uninstall pycryptodome
pip3 install pycryptodome
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!