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
来源:oschina
链接:https://my.oschina.net/tplinuxhyh/blog/4717438