我正在尝试运行这个 Dash 教程https://github.com/cryptopotluck/alpha_vantage_tutorial/tree/master/dash_bootstrap/ https://github.com/cryptopotluck/alpha_vantage_tutorial/tree/master/dash_bootstrap/
在使用 pip install -rrequirements.txt 安装需求之后,并且在正确安装所有库之后,因为 PyCharm 不再用红色下划线显示现在安装的导入库,
import dash
import dash_bootstrap_components as dbc
import dash_html_components as html
from dash.dependencies import Input, Output, State
import requests, base64
from io import BytesIO
import dash_core_components as dcc
import plotly.graph_objs as go
from collections import Counter
我总是收到这个错误:
Traceback (most recent call last):
File "dash.py", line 1, in <module>
import dash
File "dash.py", line 2, in <module>
import dash_bootstrap_components as dbc
File "/Users/user/project/venv3.8/lib/python3.8/site-packages/dash_bootstrap_components/__init__.py", line 6, in <module>
from . import _components
File "/Users/user/project/venv3.8/lib/python3.8/site-packages/dash_bootstrap_components/_components/__init__.py", line 1, in <module>
from .Alert import Alert
File "/Users/user/project/venv3.8/lib/python3.8/site-packages/dash_bootstrap_components/_components/Alert.py", line 3, in <module>
from dash.development.base_component import Component, _explicitize_args
ModuleNotFoundError: No module named 'dash.development'; 'dash' is not a package package
即使 Dash 已经安装。
我尝试了一个干净的代码,只有这两行,同样的错误:
import dash
import dash_bootstrap_components as dbc
我已经更改了虚拟环境 3.6、3.7、3.8 和 3.9 中的 python 版本,并得到了相同的错误。我已经卸载并再次安装了这些库,Dash 库、dash_bootstrap_components 库、dash-core-components、Plotly 等,以及同样的东西。
我还安装了不同版本的 Dash 和其他一些库。没有什么。
除了 dash.development 模块不存在的明显原因之外,可能还有什么原因。我错过了什么吗?