对superset进行初始化遇到Was unable to import superset Error: No module named '_sqlite3'

今天在对superset进行初始化fabmanager create-admin --app superset的时候遇到的问题

[root@localhost superset]# fabmanager create-admin --app superset
Username [admin]: admin
User first name [admin]: a
User last name [user]: a
Email [[email protected]]: a
Password: 
Repeat for confirmation: 

Was unable to import superset Error: No module named '_sqlite3'

原因:因为利用pyenv安装了多套python环境,virtualenv使用的那套python没有_sqlite3.so这个文件。没用virtualenv的时候,使用的是另外一套python_sqlite3.so,所以解决方法是先安装sqlite-devel,然后重新编译virtualenv使用的那套python

解决办法
1.先退出virtualenvpython环境,安装sqlite-devel

yum -y install sqlite-devel  

2.重新安装pyenv

curl -L https://raw.githubusercontent.com/yyuu/pyenv-installer/master/bin/pyenv-installer | bash

3.删掉原有的python环境

pyenv uninstall 3.6.7

4.重新安装python

pyenv isntall 3.6.7

5.测试一下

[root@localhost superset]# python
Python 3.6.7 (default, Oct 30 2018, 11:49:48) 
[GCC 4.8.5 20150623 (Red Hat 4.8.5-28)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import sqlite3
>>> 

最后重新执行一下superset的初始化命令就解决了

[root@localhost superset]# fabmanager create-admin --app superset
Username [admin]: admin
User first name [admin]: a
User last name [user]: a
Email [[email protected]]: a
Password: 
Repeat for confirmation: 

Recognized Database Authentications.
Admin User admin created.

你可能感兴趣的:(Linux)