摘要
- 避免出現(xiàn)依賴包的版本沖突爪幻,建議使用虛擬環(huán)境安裝公你,但是Anaconda使用
conda create -n superset python=3.7
命令創(chuàng)建虛擬環(huán)境會導致SSL模塊不可用,網(wǎng)上搜都是關于Linux下的一些方案蔓彩,不能解決問題野舶,正確的做法是用官方Python壓縮包中的對應文件替換。 - 自動安裝python-geohash會報錯夭委,需要手工下載安裝。
- 使用
pip install superset -i https://pypi.tuna.tsinghua.edu.cn/simple
安裝Superset募强,會自動安裝相關依賴包的最新版本株灸,這會導致安裝后無法使用,安裝時應指定版本pip install "pandas==0.23.4 SQLAlchemy==1.2.18" superset -i https://pypi.tuna.tsinghua.edu.cn/simple
1. 創(chuàng)建虛擬環(huán)境
> conda create -n superset python=3.7
2. 安裝superset
安裝命令
> pip install superset -i https://pypi.tuna.tsinghua.edu.cn/simple
出現(xiàn)報錯:Can't connect to HTTPS URL because the SSL module is not available
解決方法:替換_ssl.pyd文件擎值,成功蚂且!
下載對應版本官方Python壓縮包
復制其中的_ssl.pyd文件替換C:\ProgramData\Miniconda3\envs\superset\DLLs_ssl.pyd
https://zangchuantao.com/2018/using-conda-environment-in-pycharm/
再次安裝
> pip install superset -i https://pypi.tuna.tsinghua.edu.cn/simple
再次報錯:Running setup.py bdist_wheel for python-geohash ... error;
解決方法下載python-geohash的whl文件 pip install xxx.whl安裝幅恋。
網(wǎng)址:https://www.lfd.uci.edu/~gohlke/pythonlibs/
文件:python_geohash?0.8.5?cp36?cp36m?win_amd64.whl
三次安裝
> pip install superset -i https://pypi.tuna.tsinghua.edu.cn/simple
3. 創(chuàng)建管理員賬號
fabmanager create-admin --app superset
出現(xiàn)報錯:Was unable to import superset Error: cannot import name '_maybe_box_datetimelike' from 'pandas.core.common' (c:\programdata\miniconda3\envs\superset\lib\site-packages\pandas\core\common.py)
解決方法:安裝低版本pandas庫,OK泵肄!
pip install pandas==0.23.4 -i https://pypi.tuna.tsinghua.edu.cn/simple
再次創(chuàng)建
> fabmanager create-admin --app superset
4. 初始化數(shù)據(jù)庫
在superset\bin目錄下執(zhí)行
> python superset db upgrade
出現(xiàn)報錯: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版本過高捆交,安裝低版本
> pip install SQLAlchemy==1.2.18 -i https://pypi.tuna.tsinghua.edu.cn/simple
再次初始化
> python superset db upgrade
5. 加載數(shù)據(jù)
在superset\bin目錄下執(zhí)行
> python superset load_examples
6. 初始化角色和權限
在superset\bin目錄下執(zhí)行
> python superset init
7. 啟動服務,端口8088腐巢,使用-p更改端口號
在superset\bin目錄下執(zhí)行
> python superset runserver -d
8. 配置文件位置
C:\Users\admin\AppData\Local\Programs\Python\Python36\Lib\site-packages\superset文件夾下的config.py
9. 基礎教程
http://superset.apache.org/tutorial.html
10.添加Mysql數(shù)據(jù)庫
安裝相關包品追,需要重啟Superset
> pip install mysqlclient
鏈接字符串,加上charset=utf8防止亂碼
mysql://用戶名:密碼@IP:Port/database?charset=utf8