首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >dash_bootstrap_components安装成功,但未被识别

dash_bootstrap_components安装成功,但未被识别
EN

Stack Overflow用户
提问于 2020-02-01 23:19:20
回答 1查看 16K关注 0票数 6

我的仪表板运转得很好。我安装dash_bootstrap_components是为了给我的仪表板增添风格。

我写了pip install dash-bootstrap-components,安装得很完美。

但是当我运行这个应用程序时,我有一个错误:

代码语言:javascript
复制
import dash_bootstrap_components as dbc

ModuleNotFoundError:没有名为“dash_bootstrap_components”的模块

我有:破折号-1.8.0破折号-引导-部件-0.8.2

EN

回答 1

Stack Overflow用户

发布于 2020-04-16 23:05:13

我也遇到了同样的问题,我试着按照他们网站上的说明来安装:https://dash-bootstrap-components.opensource.faculty.ai/docs/quickstart/

在终端命令行中,我输入了以下内容:

代码语言:javascript
复制
pip install dash-bootstrap-components

我得到了以下错误:

由于EnvironmentError: Errno 13权限被拒绝,无法安装软件包:请考虑使用--用户选项或检查权限。

为了解决这个问题,,您可以执行以下操作(第一个为我工作):

1)将包安装到用户文件夹:

代码语言:javascript
复制
python -m pip install --user dash-bootstrap-components

2)安装虚拟env以安装包:

代码语言:javascript
复制
python3 -m venv env
source ./env/bin/activate 
python -m pip install dash-bootstrap-components

3)使用sudo安装到系统文件夹(不推荐)

代码语言:javascript
复制
sudo python -m pip install dash-bootstrap-components

这样做之后,就可以用下面的代码创建一个文件,并运行服务器来查看它是否工作

代码语言:javascript
复制
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)
票数 5
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/60021936

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档