Mac作業系統搭建輕量級BI工具Superset
阿新 • • 發佈:2020-07-22
### Mac作業系統搭建輕量級BI工具Superset > 前言 > > Superset是一款視覺化的BI工具,主要依賴於python環境。 > > pip 是一個Python包安裝與管理工具。 ##### 1、首先檢視是否存在pip >pip --version >-bash: pip: command not found ##### 2、安裝pip命令 Mac作業系統自帶了python,預設的是2.7,我們不使用自帶,安裝新版本的 Python3 的安裝方式 > curl https://bootstrap.pypa.io/get-pip.py | python3 > % Total % Received % Xferd Average Speed Time Time Time Current > Dload Upload Total Spent Left Speed > 100 1825k 100 1825k 0 0 16620 0 0:01:52 0:01:52 --:--:-- 12362 > Collecting pip > Downloading pip-20.1.1-py2.py3-none-any.whl (1.5 MB) > |████████████████████████████████| 1.5 MB 14 kB/s > Installing collected packages: pip > Attempting uninstall: pip > Found existing installation: pip 20.0.2 > Uninstalling pip-20.0.2: > Successfully uninstalled pip-20.0.2 > Successfully installed pip-20.1.1 出現 successfully,則說明pip已經安裝成功 ##### 3、安裝setuptools工具 > pip install --upgrade setuptools pip > Collecting setuptools > Downloading setuptools-49.2.0-py3-none-any.whl (789 kB) > |████████████████████████████████| 789 kB 10 kB/s > Requirement already up-to-date: pip in /usr/local/lib/python3.7/site-packages (20.1.1) > Installing collected packages: setuptools > Attempting uninstall: setuptools > Found existing installation: setuptools 46.0.0 > Uninstalling setuptools-46.0.0: > Successfully uninstalled setuptools-46.0.0 > Successfully installed setuptools-49.2.0 出現successfully,則說明setuptools已經安裝成功 ##### 4、新增支援以及初始化 安裝superset,這一步驟執行過程很慢,很不建議使用命令列模式來執行 > pip install apache-superset > Collecting apache-superset > Using cached apache-superset-0.36.0.tar.gz (47.1 MB) > Collecting backoff>=1.8.0 > Using cached backoff-1.10.0-py2.py3-none-any.whl (31 kB) > Collecting bleach<4.0.0,>=3.0.2 > Using cached bleach-3.1.5-py2.py3-none-any.whl (151 kB) > Collecting celery!=4.4.1,<5.0.0,>=4.3.0 > Using cached celery-4.4.6-py2.py3-none-any.whl (426 kB) > Collecting click<8 > Using cached click-7.1.2-py2.py3-none-any.whl (82 kB) > Collecting colorama > Using cached colorama-0.4.3-py2.py3-none-any.whl (15 kB) > Collecting contextlib2 > Using cached contextlib2-0.6.0.post1-py2.py3-none-any.whl (9.8 kB) > Collecting croniter>=0.3.28 > Using cached croniter-0.3.34-py2.py3-none-any.whl (19 kB) > Collecting cryptography>=2.4.2 > Using cached cryptography-3.0-cp35-abi3-macosx_10_10_x86_64.whl (1.8 MB) > Collecting flask<2.0.0,>=1.1.0 > Using cached Flask-1.1.2-py2.py3-none-any.whl (94 kB) > Collecting flask-appbuilder<2.4.0,>=2.3.1 > Using cached Flask_AppBuilder-2.3.4-py3-none-any.whl (1.7 MB) > Collecting flask-caching > Using cached Flask_Caching-1.9.0-py2.py3-none-any.whl (33 kB) > Collecting flask-compress > Using cached Flask-Compress-1.5.0.tar.gz (6.5 kB) > Collecting flask-talisman > Using cached flask_talisman-0.7.0-py2.py3-none-any.whl (12 kB) > Collecting flask-migrate > Using cached Flask_Migrate-2.5.3-py2.py3-none-any.whl (13 kB) > Collecting flask-wtf > Using cached Flask_WTF-0.14.3-py2.py3-none-any.whl (13 kB) > Collecting geopy > Using cached geopy-2.0.0-py3-none-any.whl (111 kB) > Collecting gunicorn<20.1,>=20.0.2 > Using cached gunicorn-20.0.4-py2.py3-none-any.whl (77 kB) > Collecting humanize > Using cached humanize-2.5.0-py3-none-any.whl (65 kB) > Collecting isodate > Using cached isodate-0.6.0-py2.py3-none-any.whl (45 kB) > Collecting markdown>=3.0 > Using cached Markdown-3.2.2-py3-none-any.whl (88 kB) > Collecting msgpack<0.7.0,>=0.6.1 > Using cached msgpack-0.6.2-cp37-cp37m-macosx_10_14_x86_64.whl (79 kB) > Collecting pandas<1.0,>=0.25.3 > Using cached pandas-0.25.3-cp37-cp37m-macosx_10_9_x86_64.whl (10.2 MB) > Collecting parsedatetime > Using cached parsedatetime-2.6-py3-none-any.whl (42 kB) > Collecting pathlib2 > Using cached pathlib2-2.3.5-py2.py3-none-any.whl (18 kB) > Collecting polyline > Using cached polyline-1.4.0-py2.py3-none-any.whl (4.4 kB) > Collecting python-dateutil > Using cached python_dateutil-2.8.1-py2.py3-none-any.whl (227 kB) > Collecting python-dotenv > Using cached python_dotenv-0.14.0-py2.py3-none-any.whl (17 kB) > Collecting python-geohash > Using cached python-geohash-0.8.5.tar.gz (17 kB) > Collecting pyarrow<0.17.0,>=0.16.0 > Using cached pyarrow-0.16.0-cp37-cp37m-macosx_10_9_intel.whl (40.5 MB) > Collecting pyyaml>=5.1 > Using cached PyYAML-5.3.1.tar.gz (269 kB) > Collecting retry>=0.9.2 > Using cached retry-0.9.2-py2.py3-none-any.whl (8.0 kB) > Collecting selenium>=3.141.0 > Using cached selenium-3.141.0-py2.py3-none-any.whl (904 kB) > Collecting simplejson>=3.15.0 > Using cached simplejson-3.17.2-cp37-cp37m-macosx_10_14_x86_64.whl (73 kB) > Collecting sqlalchemy<2.0,>=1.3.5 > Using cached SQLAlchemy-1.3.18-cp37-cp37m-macosx_10_14_x86_64.whl (1.2 MB) > Collecting sqlalchemy-utils>=0.33.2 > Using cached SQLAlchemy-Utils-0.36.8.tar.gz (138 kB) > Collecting sqlparse<0.4,>=0.3.0 > Using cached sqlparse-0.3.1-py2.py3-none-any.whl (40 kB) > Collecting wtforms-json > Using cached WTForms-JSON-0.3.3.tar.gz (11 kB) > Collecting webencodings > Using cached webencodings-0.5.1-py2.py3-none-any.whl (11 kB) > Collecting packaging > Using cached packaging-20.4-py2.py3-none-any.whl (37 kB) > Collecting six>=1.9.0 > Using cached six-1.15.0-py2.py3-none-any.whl (10 kB) > Collecting future>=0.18.0 > Using cached future-0.18.2.tar.gz (829 kB) > Collecting vine==1.3.0 > Using cached vine-1.3.0-py2.py3-none-any.whl (14 kB) > Collecting kombu<4.7,>=4.6.10 > Using cached kombu-4.6.11-py2.py3-none-any.whl (184 kB) > Collecting billiard<4.0,>=3.6.3.0 > Using cached billiard-3.6.3.0-py3-none-any.whl (89 kB) > Collecting pytz>dev > Using cached pytz-2020.1-py2.py3-none-any.whl (510 kB) > Collecting natsort > Using cached natsort-7.0.1-py3-none-any.whl (33 kB) > Collecting cffi!=1.11.3,>=1.8 > Using cached cffi-1.14.0-cp37-cp37m-macosx_10_9_x86_64.whl (174 kB) > Collecting Jinja2>=2.10.1 > Using cached Jinja2-2.11.2-py2.py3-none-any.whl (125 kB) > Collecting itsdangerous>=0.24 > Using cached itsdangerous-1.1.0-py2.py3-none-any.whl (16 kB) > Collecting Werkzeug>=0.15 > Using cached Werkzeug-1.0.1-py2.py3-none-any.whl (298 kB) > Collecting Flask-Babel<2,>=1 > Using cached Flask_Babel-1.0.0-py3-none-any.whl (9.5 kB) > Collecting PyJWT>=1.7.1 > Using cached PyJWT-1.7.1-py2.py3-none-any.whl (18 kB) > Collecting email-validator<2,>=1.0.5 > Using cached email_validator-1.1.1-py2.py3-none-any.whl (17 kB) > Collecting Flask-OpenID<2,>=1.2.5 > Using cached Flask-OpenID-1.2.5.tar.gz (43 kB) > Collecting prison<1.0.0,>=0.1.3 > Using cached prison-0.1.3-py2.py3-none-any.whl (5.8 kB) > Collecting jsonschema<4,>=3.0.1 > Using cached jsonschema-3.2.0-py2.py3-none-any.whl (56 kB) > Collecting marshmallow-sqlalchemy<1,>=0.16.1 > Using cached marshmallow_sqlalchemy-0.23.1-py2.py3-none-any.whl (18 kB) > Collecting apispec[yaml]<2,>=1.1.1 > Using cached apispec-1.3.3-py2.py3-none-any.whl (23 kB) > Collecting marshmallow<3.0.0,>=2.18.0 > Using cached marshmallow-2.21.0-py2.py3-none-any.whl (50 kB) > Collecting marshmallow-enum<2,>=1.4.1 > Using cached marshmallow_enum-1.5.1-py2.py3-none-any.whl (4.2 kB) > Collecting Flask-Login<0.5,>=0.3 > Using cached Flask-Login-0.4.1.tar.gz (14 kB) > Collecting Flask-SQLAlchemy<3,>=2.4 > Using cached Flask_SQLAlchemy-2.4.4-py2.py3-none-any.whl (17 kB) > Collecting Flask-JWT-Extended<4,>=3.18 > Using cached Flask-JWT-Extended-3.24.1.tar.gz (31 kB) > Collecting brotli > Using cached Brotli-1.0.7-cp37-cp37m-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl (796 kB) > Collecting alembic>=0.7 > Using cached alembic-1.4.2.tar.gz (1.1 MB) > Installing build dependencies ... done > Getting requirements to build wheel ... done > Preparing wheel metadata ... done > Collecting WTForms > Using cached WTForms-2.3.1-py2.py3-none-any.whl (169 kB) > Collecting geographiclib<2,>=1.49 > Using cached geographiclib-1.50-py3-none-any.whl (38 kB) > Requirement already satisfied: setuptools>=3.0 in /usr/local/lib/python3.7/site-packages (from gunicorn<20.1,>=20.0.2->apache-superset) (49.2.0) > Collecting importlib-metadata; python_version < "3.8" > Using cached importlib_metadata-1.7.0-py2.py3-none-any.whl (31 kB) > Collecting numpy>=1.13.3 > Using cached numpy-1.19.1-cp37-cp37m-macosx_10_9_x86_64.whl (15.3 MB) > Collecting decorator>=3.4.2 > Using cached decorator-4.4.2-py2.py3-none-any.whl (9.2 kB) > Collecting py<2.0.0,>=1.4.26 > Using cached py-1.9.0-py2.py3-none-any.whl (99 kB) > Collecting urllib3 > Using cached urllib3-1.25.9-py2.py3-none-any.whl (126 kB) > Collecting pyparsing>=2.0.2 > Using cached pyparsing-2.4.7-py2.py3-none-any.whl (67 kB) > Collecting amqp<2.7,>=2.6.0 > Using cached amqp-2.6.0-py2.py3-none-any.whl (47 kB) > Collecting pycparser > Using cached pycparser-2.20-py2.py3-none-any.whl (112 kB) > Collecting MarkupSafe>=0.23 > Using cached MarkupSafe-1.1.1-cp37-cp37m-macosx_10_6_intel.whl (18 kB) > Collecting Babel>=2.3 > Downloading Babel-2.8.0-py2.py3-none-any.whl (8.6 MB) > |████████████████████████████████| 8.6 MB 11 kB/s > Collecting idna>=2.0.0 > Using cached idna-2.10-py2.py3-none-any.whl (58 kB) > Collecting dnspython>=1.15.0 > Using cached dnspython-2.0.0-py3-none-any.whl (208 kB) > Collecting python3-openid>=2.0 > Using cached python3_openid-3.2.0-py3-none-any.whl (133 kB) > Collecting pyrsistent>=0.14.0 > Using cached pyrsistent-0.16.0.tar.gz (108 kB) > Collecting attrs>=17.4.0 > Using cached attrs-19.3.0-py2.py3-none-any.whl (39 kB) > Collecting python-editor>=0.3 > Downloading python_editor-1.0.4-py3-none-any.whl (4.9 kB) > Collecting Mako > Downloading Mako-1.1.3-py2.py3-none-any.whl (75 kB) > |████████████████████████████████| 75 kB 14 kB/s > Collecting zipp>=0.5 > Downloading zipp-3.1.0-py3-none-any.whl (4.9 kB) > Collecting defusedxml > Downloading defusedxml-0.6.0-py2.py3-none-any.whl (23 kB) > Building wheels for collected packages: apache-superset, flask-compress, python-geohash, pyyaml, sqlalchemy-utils, wtforms-json, future, Flask-OpenID, Flask-Login, Flask-JWT-Extended, alembic, pyrsistent > Building wheel for apache-superset (setup.py) ... done > Created wheel for apache-superset: filename=apache_superset-0.36.0-py3-none-any.whl size=47783753 sha256=47f68d11744527b36a2c97f8dd15a20c2be1910aa11f7e3c964e357546082dff > Stored in directory: /Users/Aion/Library/Caches/pip/wheels/8b/41/de/44ceb9b61f69c1935aac2546765d17164d93158e745244e6c1 > Building wheel for flask-compress (setup.py) ... done > Created wheel for flask-compress: filename=Flask_Compress-1.5.0-py3-none-any.whl size=5271 sha256=4191a753faaa5b00126e2da5400eb669f887be94214b94e1fb90f30839273853 > Stored in directory: /Users/Aion/Library/Caches/pip/wheels/d6/9f/c9/4bf2abf65cceaa8d19423bc34b88443b3b063f167d2082c212 > Building wheel for python-geohash (setup.py) ... done > Created wheel for python-geohash: filename=python_geohash-0.8.5-cp37-cp37m-macosx_10_15_x86_64.whl size=17308 sha256=c9e2d69b2b1c4d533f632c794abe419e256441acb84bb8eeaa95f280d671bbbb > Stored in directory: /Users/Aion/Library/Caches/pip/wheels/ea/62/7a/e8b943f1d8025cd93a93928a162319e56843301c8c06610ffe > Building wheel for pyyaml (setup.py) ... done > Created wheel for pyyaml: filename=PyYAML-5.3.1-cp37-cp37m-macosx_10_15_x86_64.whl size=153150 sha256=6cd630c88f30bc85939db980ff8349ad02585bae6a3bff79e09d2c3448d621e8 > Stored in directory: /Users/Aion/Library/Caches/pip/wheels/5e/03/1e/e1e954795d6f35dfc7b637fe2277bff021303bd9570ecea653 > Building wheel for sqlalchemy-utils (setup.py) ... done > Created wheel for sqlalchemy-utils: filename=SQLAlchemy_Utils-0.36.8-py2.py3-none-any.whl size=93221 sha256=205a13f19cb27c6d824f668288af59d34a810d1b718641c932b114369d4b17b0 > Stored in directory: /Users/Aion/Library/Caches/pip/wheels/29/c3/6b/495f824c202b91e5dc231e802afa062910f229ad2131588a96 > Building wheel for wtforms-json (setup.py) ... done > Created wheel for wtforms-json: filename=WTForms_JSON-0.3.3-py3-none-any.whl size=4731 sha256=023cb648a9e4392d16ba3f131c9339d148f49ccd8369c97d038f601ddc2877bf > Stored in directory: /Users/Aion/Library/Caches/pip/wheels/e2/33/56/363cdd3ef8148f9bc16803de6ff33be8196fb1613af8905ab3 > Building wheel for future (setup.py) ... done > Created wheel for future: filename=future-0.18.2-py3-none-any.whl size=491058 sha256=40f28c9a958ddb8054ab1806534d1b212c6f55920a3a655273d366825af49d70 > Stored in directory: /Users/Aion/Library/Caches/pip/wheels/56/b0/fe/4410d17b32f1f0c3cf54cdfb2bc04d7b4b8f4ae377e2229ba0 > Building wheel for Flask-OpenID (setup.py) ... done > Created wheel for Flask-OpenID: filename=Flask_OpenID-1.2.5-py3-none-any.whl size=9120 sha256=204499cb2138e97eae55897503e2ce59d438744dbabf3e48d09cc595f96ae51b > Stored in directory: /Users/Aion/Library/Caches/pip/wheels/65/7b/bb/26e83746ed4bf0e29b5fdbcfe04a65c1f9b2d007dafebd35a3 > Building wheel for Flask-Login (setup.py) ... done > Created wheel for Flask-Login: filename=Flask_Login-0.4.1-py2.py3-none-any.whl size=15935 sha256=8bcb2760f1ace30ace1c511c335943fea4c8436e0b12b94aa50723342fe70d60 > Stored in directory: /Users/Aion/Library/Caches/pip/wheels/6b/b8/33/1da5a5d39e093a68d81848aa44fd70e3cd0193e6f2d5641052 > Building wheel for Flask-JWT-Extended (setup.py) ... done > Created wheel for Flask-JWT-Extended: filename=Flask_JWT_Extended-3.24.1-py2.py3-none-any.whl size=21513 sha256=8ae46c6f88a5296c42c762fe967dc12615cbf352d731e8d774ee3a5c3afd3413 > Stored in directory: /Users/Aion/Library/Caches/pip/wheels/5d/e6/e4/0327f91fde6e288d17757185e957e91e89d06bd2dd6dd365b8 > Building wheel for alembic (PEP 517) ... done > Created wheel for alembic: filename=alembic-1.4.2-py2.py3-none-any.whl size=159543 sha256=97ee1b9ef7327e82a98b8f5e457aabe003cfa13988caeaae5a5c8eaf96ef88ae > Stored in directory: /Users/Aion/Library/Caches/pip/wheels/4e/b5/00/f93fe1c90b3d501774e91e2e99987f49d16019e40e4bd3afc3 > Building wheel for pyrsistent (setup.py) ... done > Created wheel for pyrsistent: filename=pyrsistent-0.16.0-cp37-cp37m-macosx_10_15_x86_64.whl size=68988 sha256=15356c0a39d106cb705ed1ff5cddfca270dca7619cd7c2ae3e8209da3c44c8c7 > Stored in directory: /Users/Aion/Library/Caches/pip/wheels/22/52/11/f0920f95c23ed7d2d0b05f2b7b2f4509e87a20cfe8ea43d987 > Successfully built apache-superset flask-compress python-geohash pyyaml sqlalchemy-utils wtforms-json future Flask-OpenID Flask-Login Flask-JWT-Extended alembic pyrsistent > Installing collected packages: backoff, webencodings, six, pyparsing, packaging, bleach, future, vine, zipp, importlib-metadata, amqp, kombu, billiard, pytz, celery, click, colorama, contextlib2, python-dateutil, natsort, croniter, pycparser, cffi, cryptography, MarkupSafe, Jinja2, itsdangerous, Werkzeug, flask, Babel, Flask-Babel, PyJWT, idna, dnspython, email-validator, sqlalchemy, sqlalchemy-utils, defusedxml, python3-openid, Flask-OpenID, prison, pyrsistent, attrs, jsonschema, marshmallow, marshmallow-sqlalchemy, WTForms, flask-wtf, pyyaml, apispec, marshmallow-enum, Flask-Login, Flask-SQLAlchemy, Flask-JWT-Extended, flask-appbuilder, flask-caching, brotli, flask-compress, flask-talisman, python-editor, Mako, alembic, flask-migrate, geographiclib, geopy, gunicorn, humanize, isodate, markdown, msgpack, numpy, pandas, parsedatetime, pathlib2, polyline, python-dotenv, python-geohash, pyarrow, decorator, py, retry, urllib3, selenium, simplejson, sqlparse, wtforms-json, apache-superset > Successfully installed Babel-2.8.0 Flask-Babel-1.0.0 Flask-JWT-Extended-3.24.1 Flask-Login-0.4.1 Flask-OpenID-1.2.5 Flask-SQLAlchemy-2.4.4 Jinja2-2.11.2 Mako-1.1.3 MarkupSafe-1.1.1 PyJWT-1.7.1 WTForms-2.3.1 Werkzeug-1.0.1 alembic-1.4.2 amqp-2.6.0 apache-superset-0.36.0 apispec-1.3.3 attrs-19.3.0 backoff-1.10.0 billiard-3.6.3.0 bleach-3.1.5 brotli-1.0.7 celery-4.4.6 cffi-1.14.0 click-7.1.2 colorama-0.4.3 contextlib2-0.6.0.post1 croniter-0.3.34 cryptography-3.0 decorator-4.4.2 defusedxml-0.6.0 dnspython-2.0.0 email-validator-1.1.1 flask-1.1.2 flask-appbuilder-2.3.4 flask-caching-1.9.0 flask-compress-1.5.0 flask-migrate-2.5.3 flask-talisman-0.7.0 flask-wtf-0.14.3 future-0.18.2 geographiclib-1.50 geopy-2.0.0 gunicorn-20.0.4 humanize-2.5.0 idna-2.10 importlib-metadata-1.7.0 isodate-0.6.0 itsdangerous-1.1.0 jsonschema-3.2.0 kombu-4.6.11 markdown-3.2.2 marshmallow-2.21.0 marshmallow-enum-1.5.1 marshmallow-sqlalchemy-0.23.1 msgpack-0.6.2 natsort-7.0.1 numpy-1.19.1 packaging-20.4 pandas-0.25.3 parsedatetime-2.6 pathlib2-2.3.5 polyline-1.4.0 prison-0.1.3 py-1.9.0 pyarrow-0.16.0 pycparser-2.20 pyparsing-2.4.7 pyrsistent-0.16.0 python-dateutil-2.8.1 python-dotenv-0.14.0 python-editor-1.0.4 python-geohash-0.8.5 python3-openid-3.2.0 pytz-2020.1 pyyaml-5.3.1 retry-0.9.2 selenium-3.141.0 simplejson-3.17.2 six-1.15.0 sqlalchemy-1.3.18 sqlalchemy-utils-0.36.8 sqlparse-0.3.1 urllib3-1.25.9 vine-1.3.0 webencodings-0.5.1 wtforms-json-0.3.3 zipp-3.1.0 ##### 5、安裝完成後,為了支援mysql,此處增加mysqlclient的指令碼, > brew install mysqlclient > > brew install mysql-connector-c > > pip install mysqlclient > > pip3 install mysqlclient >Collecting mysqlclient >Using cached mysqlclient-2.0.1.tar.gz (87 kB) >Building wheels for collected packages: mysqlclient >Building wheel for mysqlclient (setup.py) ... done >Created wheel for mysqlclient: filename=mysqlclient-2.0.1-cp37-cp37m-macosx_10_15_x86_64.whl size=55758 sha256=f882c605ede9d2bc1b3654f81349cc56f7278e7e8bbb302abea6c032de642c86 >Stored in directory: /Users/Aion/Library/Caches/pip/wheels/f0/33/cd/bfa1399be3b3b6fc77eb6a53e446eed887b1a35c90d0e3cbf2 >Successfully built mysqlclient >Installing collected packages: mysqlclient >Successfully installed mysqlclient-2.0.1 出現 successfully,則說明pip mysqlclient已經安裝成功 我筆記本安裝的時候提示我mysql_config not found,我這邊一直沒有安裝上去,查看了配置檔案是有的,只是沒有設定軟連線,設定一下,然後再次執行pip install mysqlclient即可。 > ln -s /usr/local/mysql/bin/mysql_config /usr/local/bin/mysql_config ##### 6、初始化資料、資料庫、賬號資訊 初始化資料庫 > superset db upgrade 建立管理員使用者 > superset fab create-admin 建立預設的許可權和角色 > superset load_examples 開啟web服務,繫結埠 > superset run -p 8088 --with-threads --reload --debugger ##### 7、瀏覽器訪問,使用賬號密碼登入 > http://localhos:8088 其他安裝方式,請參考官網(http://superset.apache.org/)或者其他資訊網站。