python連接hive需要安裝sasl等組件:
pip install sasl
pip install thrift
pip install thrift-sasl
pip install PyHive
但是安裝sasl的時(shí)候,在centos下會(huì)出現(xiàn)報(bào)錯(cuò)的問(wèn)題,我在ubuntu上安裝的時(shí)候還好沒(méi)有出問(wèn)題,但是在centos7.7下安裝sasl的時(shí)候,直接報(bào)錯(cuò)了。
開始提示錯(cuò)誤信息入如下:
/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
關(guān)鍵信息是這里:
error: command '/bin/gcc' failed with exit code 1
這個(gè)意思是沒(méi)有安裝gcc相關(guān)的組件,直接安裝gcc還不行,還是會(huì)報(bào)錯(cuò),gcc相關(guān)的組件都要安裝:
sudo yum install gcc gcc-c++ python-devel.x86_64 cyrus-sasl-devel.x86_64 gcc-c++.x86_64
再執(zhí)行pip install sasl是正常。
如果是windows系統(tǒng),直接用pip無(wú)法安裝。
處理辦法就是從官網(wǎng)下載到本地后安裝即可:
官網(wǎng):
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