ModuleNotFoundError: No module named '_brotli' 解决方法参考
报错
Traceback (most recent call last): File "d:/pppython/python/python_all_by_study/Dash_for_study/基础回调/多个输出/1.py", line 1, in <module> import dash File "D:\cpython\lib\site-packages\dash\__init__.py", line 5, in <module> from .dash import Dash, no_update # noqa: F401,E402 File "D:\cpython\lib\site-packages\dash\dash.py", line 17, in <module> from flask_compress import Compress File "D:\cpython\lib\site-packages\flask_compress\__init__.py", line 1, in <module> from .flask_compress import Compress File "D:\cpython\lib\site-packages\flask_compress\flask_compress.py", line 14, in <module> import brotli File "D:\cpython\lib\site-packages\brotli.py", line 8, in <module> import _brotli ModuleNotFoundError: No module named '_brotli'
查看控制台发现 _brotli被升级为Brotli
卸载dash 卸载Brotil再重新安装dash即可
pip uninstall dash pip uninstall Brotli pip install dash
PS D:\pppython\python> pip install dash WARNING: Ignoring invalid distribution -ip (d:\cpython\lib\site-packages) WARNING: Ignoring invalid distribution - (d:\cpython\lib\site-packages) WARNING: Ignoring invalid distribution -ip (d:\cpython\lib\site-packages) WARNING: Ignoring invalid distribution - (d:\cpython\lib\site-packages) Collecting dash Using cached dash-2.0.0-py3-none-any.whl (7.3 MB) Requirement already satisfied: dash-html-components==2.0.0 in d:\cpython\lib\site-packages (from dash) (2.0.0) Requirement already satisfied: dash-table==5.0.0 in d:\cpython\lib\site-packages (from dash) (5.0.0) Requirement already satisfied: dash-core-components==2.0.0 in d:\cpython\lib\site-packages (from dash) (2.0.0) Requirement already satisfied: plotly>=5.0.0 in d:\cpython\lib\site-packages (from dash) (5.3.1) Requirement already satisfied: flask-compress in d:\cpython\lib\site-packages (from dash) (1.10.1) Requirement already satisfied: Flask>=1.0.4 in d:\cpython\lib\site-packages (from dash) (2.0.2) Requirement already satisfied: click>=7.1.2 in d:\cpython\lib\site-packages (from Flask>=1.0.4->dash) (8.0.3) Requirement already satisfied: Jinja2>=3.0 in d:\cpython\lib\site-packages (from Flask>=1.0.4->dash) (3.0.2) Requirement already satisfied: Werkzeug>=2.0 in d:\cpython\lib\site-packages (from Flask>=1.0.4->dash) (2.0.2) Requirement already satisfied: itsdangerous>=2.0 in d:\cpython\lib\site-packages (from Flask>=1.0.4->dash) (2.0.1) Requirement already satisfied: six in d:\cpython\lib\site-packages (from plotly>=5.0.0->dash) (1.16.0) Requirement already satisfied: tenacity>=6.2.0 in d:\cpython\lib\site-packages (from plotly>=5.0.0->dash) (8.0.1) Collecting brotli Downloading Brotli-1.0.9-cp38-cp38-win_amd64.whl (365 kB) |████████████████████████████████| 365 kB 1.6 MB/s Requirement already satisfied: colorama in d:\cpython\lib\site-packages (from click>=7.1.2->Flask>=1.0.4->dash) (0.4.4) Requirement already satisfied: MarkupSafe>=2.0 in d:\cpython\lib\site-packages (from Jinja2>=3.0->Flask>=1.0.4->dash) (2.0.1) WARNING: Ignoring invalid distribution -ip (d:\cpython\lib\site-packages) WARNING: Ignoring invalid distribution - (d:\cpython\lib\site-packages) Installing collected packages: brotli, dash WARNING: Ignoring invalid distribution -ip (d:\cpython\lib\site-packages) WARNING: Ignoring invalid distribution - (d:\cpython\lib\site-packages) WARNING: Ignoring invalid distribution -ip (d:\cpython\lib\site-packages) WARNING: Ignoring invalid distribution - (d:\cpython\lib\site-packages) Successfully installed brotli-1.0.9 dash-2.0.0 WARNING: Ignoring invalid distribution -ip (d:\cpython\lib\site-packages) WARNING: Ignoring invalid distribution - (d:\cpython\lib\site-packages) WARNING: Ignoring invalid distribution -ip (d:\cpython\lib\site-packages) PS D:\pppython\python> & D:/cpython/python.exe d:/pppython/python/python_all_by_study/Dash_for_study/基础回调/多个输入/1.py d:/pppython/python/python_all_by_study/Dash_for_study/基础回调/多个输入/1.py:2: UserWarning: The dash_core_components package is deprecated. Please replace `import dash_core_components as dcc` with `from dash import dcc` import dash_core_components as dcc d:/pppython/python/python_all_by_study/Dash_for_study/基础回调/多个输入/1.py:3: UserWarning: The dash_html_components package is deprecated. Please replace `import dash_html_components as html` with `from dash import html` import dash_html_components as html Traceback (most recent call last): File "d:/pppython/python/python_all_by_study/Dash_for_study/基础回调/多个输入/1.py", line 5, in <module> import plotly.express as px File "D:\cpython\lib\site-packages\plotly\express\__init__.py", line 10, in <module> raise ImportError( ImportError: Plotly express requires pandas to be installed. PS D:\pppython\python> & D:/cpython/python.exe d:/pppython/python/python_all_by_study/Dash_for_study/基础回调/简单的交互应用/1.py Dash is running on http://127.0.0.1:8050/ * Serving Flask app '1' (lazy loading) * Environment: production WARNING: This is a development server. Do not use it in a production deployment. Use a production WSGI server instead. * Debug mode: on
-------------====================分割线====================-------------