window10快速安装superset,避免种种大坑

构建虚拟环境

在cmd(管理员模式下)

输入

conda create -n superset python=3.7

激活虚拟环境

C:\Users\23645>activate superset
(superset) C:\Users\23645>

虚拟环境下安装cryptography

(superset) C:Users23645>pip install cryptography

虚拟环境下更新setuptools 和 pip

(superset) C:Users23645>pip install --upgrade setuptools pip

虚拟环境下安装 superset

(superset) C:Users23645>pip install superset

虚拟环境下批量安装包

D盘下新建pacakge.txt,内容如下

flask
wtforms_json
flask_appbuilder
flask_compress
flask_migrate
flask_talisman
flask_caching
email_validator
celery
sqlparse
bleach
markdown
numpy
pandas==0.23.4
pathlib2
simplejson
humanize
polyline
geopy
backoff
pyarrow
croniter
retry
isodate
SQLAlchemy==1.2
parsedatetime
geohash
msgpack
contextlib2
selenium

在cmd(管理员)输入

(superset) C:Users23645>pip install -r D:package.txt -i https://mirrors.aliyun.com/pypi/simple/

升级数据库

记住,上边是一定要在虚拟环境下的C盘中安装,下面升级数据库进入superset下bin中执行。

(superset) C:Users23645>D:

(superset) D:>cd D:softanacondaenvssupersetLibsite-packagessupersetbin

(superset) D:softanacondaenvssupersetLibsite-packagessupersetbin>python  superset db upgrade

两个修改

  1. 错误:ModuleNotFoundError: No module named 'geohash'

安装后,D:softanacondaenvssupersetLibsite-packages找到Geohash文件夹,改成geohash;找到文件夹里的*init*.py,将文件里的geohash改成.geohash

from .geohash import decode_exactly, decode, encode
  1. D:softanacondaenvssupersetLibsite-packagessuperset下找到config.py,打开将
CACHE_CONFIG: CacheConfig = {"CACHE_TYPE": "null"}
TABLE_NAMES_CACHE_CONFIG: CacheConfig = {"CACHE_TYPE": "null"}

改成

CACHE_CONFIG: CacheConfig = {"CACHE_TYPE": "simple"} TABLE_NAMES_CACHE_CONFIG: CacheConfig = {"CACHE_TYPE": "simple"}

创建管理员账号和密码

(superset) D:softanacondaenvssupersetLibsite-packagessupersetbin>python superset fab create-admin

INFO:root:logging was configured successfully

Username [admin]: cc
User first name [admin]: cc
User last name [user]: cc
Email [admin@fab.org]: cc@qq.com
Password:
Repeat for confirmation:
Recognized Database Authentications.

载入案例数据(若不成功,则跳过)

(superset) D:softanacondaenvssupersetLibsite-packagessupersetbin>python superset load-examples

初始化数据库

(superset) D:softanacondaenvssupersetLibsite-packagessupersetbin>python superset init

启动服务

(superset) D:softanacondaenvssupersetLibsite-packagessupersetbin>python superset run

结果

INFO:root:logging was configured successfully
 * Environment: production
   WARNING: This is a development server. Do not use it in a production deployment.
   Use a production WSGI server instead.
 * Debug mode: off
INFO:werkzeug: * Running on http://127.0.0.1:5000/ (Press CTRL+C to quit)

打开网页

复制http://127.0.0.1:5000/到浏览器打开网页,输入账号和密码,即可进入。

修改数据库

在cmd 按ctrl + C 退出,安装 pymysql和mysqlclient

(superset) D:softanacondaenvssupersetLibsite-packagessupersetbin>pip install pymysql

(superset) D:softanacondaenvssupersetLibsite-packagessupersetbin>pip install mysqlclient

D:softanacondaenvssupersetLibsite-packagessuperset找到config.py,打开将

SQLALCHEMY_DATABASE_URI = "sqlite:///" + os.path.join(DATA_DIR, "superset.db")

改成

SQLALCHEMY_DATABASE_URI='mysql+pymysql://root:123456cz@localhost:3306/data?charset=utf8'

然后重新连接superset。

(superset) D:softanacondaenvssupersetLibsite-packagessupersetbin>python superset run
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值