linux 安装pip_安装 superset

b0c161b5c5ed1c1ac591a4c7ad6d8bbe.png

创建虚拟环境:

python -m venv msuperset

激活虚拟环境:

cd msuperset
source bin/activate

安装 superset

pip install superset

如果遇到报错:

  Running setup.py install for python-geohash ... error
    Complete output from command /root/code/python/msuperset/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-szdbf0qe/python-geohash/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('rn', 'n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-omybv2pz-record/install-record.txt --single-version-externally-managed --compile --install-headers /root/code/python/msuperset/include/site/python3.6/python-geohash:
    running install
    running build
    running build_py
    creating build
    creating build/lib.linux-x86_64-3.6
    copying geohash.py -> build/lib.linux-x86_64-3.6
    copying quadtree.py -> build/lib.linux-x86_64-3.6
    copying jpgrid.py -> build/lib.linux-x86_64-3.6
    copying jpiarea.py -> build/lib.linux-x86_64-3.6
    running build_ext
    building '_geohash' extension
    creating build/temp.linux-x86_64-3.6
    creating build/temp.linux-x86_64-3.6/src
    gcc -pthread -B /root/miniconda3/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -DPYTHON_MODULE=1 -I/root/code/python/msuperset/include -I/root/miniconda3/include/python3.6m -c src/geohash.cpp -o build/temp.linux-x86_64-3.6/src/geohash.o
    gcc: error trying to exec 'cc1plus': execvp: No such file or directory
    error: command 'gcc' failed with exit status 1
    
    ----------------------------------------
Command "/root/code/python/msuperset/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-szdbf0qe/python-geohash/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('rn', 'n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-omybv2pz-record/install-record.txt --single-version-externally-managed --compile --install-headers /root/code/python/msuperset/include/site/python3.6/python-geohash" failed with error code 1 in /tmp/pip-build-szdbf0qe/python-geohash/

需要安装 gcc-c++

yum install gcc-c++

装完 gcc-c++ 后,再执行 pip install superset 应该就没问题了。

配置 superset

创建管理员用户

fabmanager create-admin --app superset

执行的时候会有这么一行提示:

fabmanager is going to be deprecated in 2.2.X, you can use the same commands on the improved 'flask fab <command>'

但是如果换成 flask fab create-admin --app superset,会报错:Error: no such option: --app

接着会让你输入用户名(username)、Fist Name、Last Name、邮箱地址、密码、重复密码。

如果遇到以下错误:

Was unable to import superset Error: cannot import name '_maybe_box_datetimelike'

原因是 pandas (在安装 superset 时会做为依赖被安装上)版本太高,需要卸载,再安装低版本的 pandas

pip install pandas==0.23.4

参考https://blog.csdn.net/kongxx/article/details/89006787

然后重新执行创建管理员用户的命令:

fabmanager create-admin --app superset

初始化数据库

superset db upgrade

如果遇到错误:

...
  File "/root/code/python/msuperset/lib/python3.6/site-packages/sqlalchemy/orm/query.py", line 2572, in _join_determine_implicit_left_side
    "Can't determine which FROM clause to join "
sqlalchemy.exc.InvalidRequestError: Can't determine which FROM clause to join from, there are multiple FROMS which can join to this entity. Try adding an explicit ON clause to help resolve the ambiguity.

说明 sqlalchemy 版本太高了,要降级 sqlalchemy

pip install sqlalchemy==1.2.18

参考https://github.com/apache/incubator-superset/issues/6977

载入测试数据

superset load_examples

初始化角色和权限

superset init

启动服务

端口号 8088,使用 -p 更改端口号

superset runserver

然后在浏览器中打开 http://localhsot:8088 就可以看到 superset 了

添加 mysql 数据源时出错

提示

ModuleNotFoundError: No module named 'MySQLdb'

因为 MySQLdb 是 python2 的产品。可使用 mysqlclient 方式代替。要安装 mysqlclient

先安装需要用到的系统依赖:

Ubuntu 下:

sudo apt-get install python3-dev libmysqlclient-dev

CentOS 下:

yum install python-devel mysql-devel

然后安装 mysqlclient

pip install mysqlclient

其它操作参考: 轻量级BI工具Superset的搭建与使用

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值