python连接hive需要安装sasl等组件:
pip install sasl
pip install thrift
pip install thrift-sasl
pip install PyHive
但是安装sasl的时候,在centos下会出现报错的问题,我在ubuntu上安装的时候还好没有出问题,但是在centos7.7下安装sasl的时候,直接报错了。
开始提示错误信息入如下:
/home/ys/miniconda3/include -I/home/ys/miniconda3/include -fPIC -O2 -isystem /home/ys/miniconda3/include -fPIC -Isasl -I/home/ys/miniconda3/include/python3.9 -c sasl/saslwrapper.cpp -o build/temp.linux-x86_64-3.9/sasl/saslwrapper.o
gcc: error trying to exec 'cc1plus': execvp: No such file or directory
error: command '/bin/gcc' failed with exit code 1
----------------------------------------
ERROR: Failed building wheel for sasl
Running setup.py clean for sasl
Failed to build sasl
Installing collected packages: sasl
Running setup.py install for sasl ... error
关键信息是这里:
error: command '/bin/gcc' failed with exit code 1
这个意思是没有安装gcc相关的组件,直接安装gcc还不行,还是会报错,gcc相关的组件都要安装:
sudo yum install gcc gcc-c++ python-devel.x86_64 cyrus-sasl-devel.x86_64 gcc-c++.x86_64
再执行pip install sasl是正常。
如果是windows系统,直接用pip无法安装。
处理办法就是从官网下载到本地后安装即可:
官网:
https://www.lfd.uci.edu/~gohlke/pythonlibs/#sasl
注意要下载跟自己电脑上版本一致的版本。
(base) C:\Users\admin>pip install C:\Users\admin\Downloads\ad3-2.2.1-cp39-cp39-win_amd64.whl
Looking in indexes: http://mirrors.aliyun.com/pypi/simple/
Processing c:\users\admin\downloads\ad3-2.2.1-cp39-cp39-win_amd64.whl
Installing collected packages: ad3
Successfully installed ad3-2.2.1