我的仪表板运转得很好。我安装dash_bootstrap_components是为了给我的仪表板增添风格。
我写了pip install dash-bootstrap-components,安装得很完美。
但是当我运行这个应用程序时,我有一个错误:
import dash_bootstrap_components as dbcModuleNotFoundError:没有名为“dash_bootstrap_components”的模块
我有:破折号-1.8.0破折号-引导-部件-0.8.2
发布于 2020-04-16 23:05:13
我也遇到了同样的问题,我试着按照他们网站上的说明来安装:https://dash-bootstrap-components.opensource.faculty.ai/docs/quickstart/
在终端命令行中,我输入了以下内容:
pip install dash-bootstrap-components我得到了以下错误:
由于EnvironmentError: Errno 13权限被拒绝,无法安装软件包:请考虑使用--用户选项或检查权限。
为了解决这个问题,,,您可以执行以下操作(第一个为我工作):
1)将包安装到用户文件夹:
python -m pip install --user dash-bootstrap-components2)安装虚拟env以安装包:
python3 -m venv env
source ./env/bin/activate
python -m pip install dash-bootstrap-components3)使用sudo安装到系统文件夹(不推荐)
sudo python -m pip install dash-bootstrap-components这样做之后,就可以用下面的代码创建一个文件,并运行服务器来查看它是否工作
import dash
import dash_bootstrap_components as dbc
app = dash.Dash(external_stylesheets=[dbc.themes.BOOTSTRAP])
app.layout = dbc.Container(
dbc.Alert("Hello Bootstrap!", color="success"),
className="p-5",
)
if __name__ == "__main__":
app.run_server(debug=True)https://stackoverflow.com/questions/60021936
复制相似问题