0
私はBcryptモジュールを使いたいと思っています。次のように私は、迅速なテスト目的のためにこれを持っている:Pythonでのみ動作するPython Bcrypt Interpretor
import bcrypt
password = b"super secret password"
hashed = bcrypt.hashpw(password, bcrypt.gensalt())
if bcrypt.checkpw(password, hashed):
print("It matches!")
else:
print("Password doesnt match")
これを実行しようと、私は次のエラーが表示されます
Traceback (most recent call last):
File "bcrypt.py", line 1, in <module>
import bcrypt
File "/Users/Kai/playground/bcrypt.py", line 5, in <module>
hashed = bcrypt.hashpw(password, bcrypt.gensalt())
AttributeError: module 'bcrypt' has no attribute 'hashpw'
、WITHINのPythonインタプリタのこの内部を実行しようとしています"playground"ディレクトリに同じエラーが表示されます。
しかし、私は私のホームディレクトリ~/
に行くとPythonインタプリタを通じて同じコードを実行すると、それは完全に正常に動作
私は両方pip3 install bcrypt --upgrade
& pip install bcrypt --upgrade
を行っています。
私はこの問題を解決するために何ができるかを知りたいのですが、Python3もアンインストールして再インストールしました。
ファイル 'bcrypt.py'を呼び出しましたか?もしそうなら、しないでください。 – user2357112