我已经安装了py-bcrypt和bcrypt。
import bcrypt
from eve import Eve
from eve.auth import BasicAuth
password = u'password'
password_hashed = bcrypt.hashpw(password, bcrypt.gensalt())
print password_hashed
File "/var/www/eve2/bcrypt.py", line 19, in <module>
password_hashed = bcrypt.hashpw(password, bcrypt.gensalt())
AttributeError: 'module' object has no attribute 'hashpw'
答案 0 :(得分:3)
您需要将文件重命名为bcrypt.py以外的其他文件。现在,您的脚本正在尝试导入自己。