需要 python 3.6+ pip install cryptography 使用 from cryptography.fernet import Fernetkey = Fernet.generate_key()f = Fernet(key)token = f.encrypt(b'welcome to django')print(token)d = f.decrypt(token)print(d)