linux 环境,Anaconda3 python3.6
安装方式:pip install pyhive 或是 conda install pyhive
报错1,例如:
ModuleNotFoundError: No module named 'thrift'
ModuleNotFoundError: No module named 'past' (future 包)
ModuleNotFoundError: No module named 'sasl'
ModuleNotFoundError: No module named 'thrift_sasl'
解决方法:若无法直接conda install , 到anaconda官网,搜索需要的包: https://anaconda.org/anaconda/,
例如: 搜索 pyhive, 下载对应python版本的压缩包pyhive-0.6.0-py36_0.tar.bz2,
然后 conda install pyhive-0.6.0-py36_0.tar.bz2,完成。
报错2:ImportError: libsasl2.so.3: cannot open shared object file: No such file or directory
解决方法:ln -s /usr/lib64/libsasl2.so /usr/lib64/libsasl2.so.3
二、python 连接hive from pyhive import hiveconn = hive.Connection(host="XXX", port='XXX', username='XXX',password='XXX',database='XXX',auth="LDAP") cursor = conn .cursor()cursor.execute("select * from xxx")result = cursor.fetchall()df = pd.DataFrame(list(result))python连接mysql: https://blog.csdn.net/kerry_55/article/details/105789298
python连接oracle: https://blog.csdn.net/kerry_55/article/details/93390592