Centos7 Python2.7 Superset安装配置

版权声明:本文为博主原创文章,转载请注明出处。 https://blog.csdn.net/ifwinds/article/details/81912153

Superset(Caravel)是由Airbnb(知名在线房屋短租公司)开源的数据分析与可视化平台(曾用名Caravel、Panoramix),该工具主要特点是可自助分析、自定义仪表盘、分析结果可视化(导出)、用户/角色权限控制,还集成了一个SQL编辑器,可以进行SQL编辑查询等。

官方文档:http://superset.apache.org/
安装教程:http://superset.apache.org/installation.html
pymysql:http://www.pymssql.org/en/stable/


Python版本

Superset是在Python2.7和Python3.4下测试的,Airbnb生产环境使用的Python版本是2.7.x,并且Airbnb不打算支持Python2.6。因为Centos7自带的Python是2.7.x版本,所以无需额外安装。可以通过python -V查看Python的版本。

Superset is tested against Python 2.7 and Python 3.4. 
Airbnb currently uses 2.7.* in production. We do not plan on supporting Python 2.6.

安装步骤

OS dependencies

For Fedora and RHEL-derivatives, the following command will ensure that the required dependencies are installed:

  • sudo yum upgrade python-setuptools
    sudo yum install gcc gcc-c++ libffi-devel python-devel python-pip python-wheel openssl-devel libsasl2-devel openldap-devel
Python’s setup tools and pip

Put all the chances on your side by getting the very latest pip and setuptools libraries.:

  • pip install –upgrade setuptools pip
Superset installation and initialization

Install superset

  • pip install superset

Create an admin user (you will be prompted to set username, first and last name before setting a password)

  • fabmanager create-admin –app superset

    Username [admin]: admin
    User first name [admin]: admin
    User last name [user]: admin
    Email [[email protected]]: admin
    Password: 
    Repeat for confirmation: 
    

Initialize the database

  • superset db upgrade

Load some data to play with

  • superset load_examples

Create default roles and permissions

  • superset init

To start a development web server on port 8088, use -p to bind to another port

  • superset runserver -d 或 nohup superset runserver -p 8088 &
    这里写图片描述

MySQL数据源

  • 安装MySQL
pip install PyMySQL --trusted-host pypi.douban.com
  • 在/usr/lib/python2.7/site-packages/sqlalchemy_utils目录下的_ init_.py文件中添加如下两行代码,就可以用 import MySQLdb了
import pymysql
pymysql.install_as_MySQLdb()
  • 重启Superset服务
  • 添加MySQL数据源
  • 这里写图片描述
  • 这里写图片描述

常见问题

  • 中文显示问题:’ascii’ codec can’t encode characters in position
    在/usr/lib/python2.7/site-packages/sqlalchemy_utils目录下的_ init_.py文件中添加如下三行代码,重启Superset即可。
import sys  
reload(sys)  
sys.setdefaultencoding('utf8') 

参考文献:
https://www.cnblogs.com/netbloomy/p/6689373.html
https://blog.csdn.net/wjl7813/article/details/79983211
https://blog.csdn.net/zeng133/article/details/76684844?locationNum=9&fps=1
https://blog.csdn.net/qq_33440665/article/details/65448120
http://muruiheng.iteye.com/blog/2412424

猜你喜欢

转载自blog.csdn.net/ifwinds/article/details/81912153