我正在尝试运行此Dash教程https://github.com/cryptopotluck/alpha_vantage_tutorial/tree/master/dash_bootstrap/
在用pip install -r requirements.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
我在我的虚拟环境中更改了python版本3.6、3.7、3.8和3.9,得到了相同的错误。我再次卸载并安装库,Dash库,dash_bootstrap_components库,dash-core-components,Plotly等等,还有同样的东西。
我还安装了不同版本的Dash和其他一些库。没什么。
除了dash.development模块不存在这一显而易见的原因之外,还有什么可能的原因。我是不是遗漏了什么?
发布于 2021-01-06 07:25:11
您可能没有最新版本的dash。不能保证它不会破坏你的教程,但可以试试这些:
pip install --upgrade dash dash-core-components dash-html-components dash-renderer
对于Conda:
conda install dash dash-core-components dash-html-components dash-renderer -c conda-forge
https://stackoverflow.com/questions/65587818
复制相似问题