2

我已经安装了 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'
4

1 回答 1

3

您需要将文件重命名为 bcrypt.py 以外的名称。现在,您的脚本正在尝试导入自身。

于 2014-05-14T02:29:07.767 回答