web-dev-qa-db-ja.com

Flaskを実行すると、次のエラーが表示されます:ModuleNotFoundError: 'werkzeug.contrib'という名前のモジュールはありません。誰かがこれを手伝ってくれませんか?

私が得る正確なエラーは:

flask.cli.NoAppException: While importing "application", an ImportError was raised:Traceback      (most recent call last):
File "/home/harshit/.local/lib/python3.6/site-packages/flask/cli.py", line 240, in     locate_app
__import__(module_name)
File "/home/harshit/Documents/project1/application.py", line 18, in <module>
Session(app)
File "/home/harshit/.local/lib/python3.6/site-packages/flask_session/__init__.py", line 54,    in __init__
self.init_app(app)
File "/home/harshit/.local/lib/python3.6/site-packages/flask_session/__init__.py", line 61, in init_app
app.session_interface = self._get_interface(app)
File "/home/harshit/.local/lib/python3.6/site-packages/flask_session/__init__.py", line 93, in _get_interface
config['SESSION_USE_SIGNER'], config['SESSION_PERMANENT'])
File "/home/harshit/.local/lib/python3.6/site-packages/flask_session/sessions.py", line 313, in __init__
from werkzeug.contrib.cache import FileSystemCache
ModuleNotFoundError: No module named 'werkzeug.contrib'

Flaskからセッションをインポートしようとしています

4
Harshit

Python 3.8の場合

python3 -m pip uninstall werkzeug
python3 -m pip install werkzeug
python3 -m pip install flask-session
0
Ken