欢迎来到尧图网

客户服务 关于我们

您的位置:首页 > 新闻 > 社会 > Superset安装

Superset安装

2025/4/3 4:03:42 来源:https://blog.csdn.net/qq_45626867/article/details/141820426  浏览:    关键词:Superset安装

安装步骤

    • 背景
    • 安装miniconda3
      • 下载及安装miniconda3
      • 安装
      • 一直回车,遇到yes/no就yes
      • 加载环境变量
    • 创建 Python3.9 环境
      • 配置 conda 国内镜像
      • 创建 Python3.9 环境
      • 激活 superset 环境
    • 安装Superset
      • 安装依赖
      • 安装(更新)setuptools 和 pip
      • 安装 Supetset
      • 初始化 Supetset 数据库
      • 报错
      • 解决方法(没报错就不用做这一步,直接跳过)
      • 创建管理员账号
      • Superset 初始化
    • Superset 启动
      • 安装 gunicorn
      • 启动
      • 停止 superset
    • 汉化Superset
      • 修改superset_config.py

背景

Superset是一款可视化图表工具,学习一下安装部署,感觉安装过程中坑挺多的,所以记录一下。

安装miniconda3

Superset安装需要Python 3.7及以上版本,而CentOS自带的是Python 2.7版本, yum需要使用Python 2.7,所以需要同时安装Python 3版本和Python 2版本。此时可以借助miniconda3来同时安装Python 3版本和Python 2版本。

下载及安装miniconda3

cd /home/software
wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh

安装

bash Miniconda3-latest-Linux-x86_64.sh

一直回车,遇到yes/no就yes

加载环境变量

source ~/.bashrc

如果你不希望conda的基本环境在启动时被激活,设置auto_activate_base参数为false:

conda config --set auto_activate_base false

创建 Python3.9 环境

一般来讲使用base 环境是直接可以操作python3.7的,为了学习一下conda国内镜像,

配置 conda 国内镜像

conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main

创建 Python3.9 环境

conda create --name superset python=3.9

说明:conda 环境管理常用命令

创建环境:conda create -n env_name python=3.9
查看所有环境:conda info --envs
删除一个环境:conda remove -n env_name --all

激活 superset 环境

conda activate superset

安装Superset

安装依赖

yum install -y gcc gcc-c++ libffi-devel python-devel python-pip python-wheel python-setuptools openssl-devel cyrus-sasl-devel openldap-devel

安装(更新)setuptools 和 pip

pip install --upgrade setuptools pip -i https://mirrors.aliyun.com/pypi/simple/

安装 Supetset

pip install apache-superset -i https://mirrors.aliyun.com/pypi/simple/

初始化 Supetset 数据库

superset db upgrade

报错

A Default SECRET_KEY was detected, please use superset_config.py to override it.
Use a strong complex alphanumeric string and use a tool to help you generate 
a sufficiently random sequence, ex: openssl rand -base64 42

在这里插入图片描述

解决方法(没报错就不用做这一步,直接跳过)

生成 SECRET_KEY
openssl rand -base64 42
vim 配置 superset_config.py 文件
写入:SECRET_KEY="SECRET_KEY生成的密钥"
export SUPERSET_CONFIG_PATH=./superset_config.py

创建管理员账号

export FLASK_APP=superset
superset fab create-admin

Superset 初始化

superset init

Superset 启动

安装 gunicorn

pip install gunicorn -i https://mirrors.aliyun.com/pypi/simple/

启动

gunicorn --workers 5 --timeout 120 --bind 本机ip:8787 "superset.app:create_app()" --daemon

停止 superset

ps -ef | awk '/superset/ && !/awk/{print $2}' | xargs kill -9

汉化Superset

修改superset_config.py

#设置默认语言为中文BABEL_DEFAULT_LOCALE = "zh"LANGUAGES = {"zh": {"flag": "cn", "name": "简体中文"},"en": {"flag": "us", "name": "English"},}

版权声明:

本网仅为发布的内容提供存储空间,不对发表、转载的内容提供任何形式的保证。凡本网注明“来源:XXX网络”的作品,均转载自其它媒体,著作权归作者所有,商业转载请联系作者获得授权,非商业转载请注明出处。

我们尊重并感谢每一位作者,均已注明文章来源和作者。如因作品内容、版权或其它问题,请及时与我们联系,联系邮箱:809451989@qq.com,投稿邮箱:809451989@qq.com

热搜词