安装pyhive还需要安装其他依赖包
pip install sasl
pip install thrift
pip install thrift-sasl
pip install PyHive
安装sasl遇到的问题
Collecting sasl
Using cached https://files.pythonhosted.org/packages/8e/2c/45dae93d666aea8492678499e0999269b4e55f1829b1e4de5b8204706ad9/sasl-0.2.1.tar.gz
Requirement already satisfied: six in /Users/jiang/.local/lib/python3.7/site-packages (from sasl) (1.15.0)
Building wheels for collected packages: sasl
Running setup.py bdist_wheel for sasl ... error
Complete output from command /Users/jiang/anaconda3/bin/python -u -c "import setuptools, tokenize;__file__='/private/var/folders/dh/lz2xjpzn5wqdhp6xtbrng_z00000gn/T/pip-install-ykoaejda/sasl/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d /private/var/folders/dh/lz2xjpzn5wqdhp6xtbrng_z00000gn/T/pip-wheel-nihe_8c0 --python-tag cp37:
running bdist_wheel
running build
running build_py
creating build
creating build/lib.macosx-10.7-x86_64-3.7
creating build/lib.macosx-10.7-x86_64-3.7/sasl
copying sasl/__init__.py -> build/lib.macosx-10.7-x86_64-3.7/sasl
running egg_info
writing sasl.egg-info/PKG-INFO
writing dependency_links to sasl.egg-info/dependency_links.txt
writing requirements to sasl.egg-info/requires.txt
writing top-level names to sasl.egg-info/top_level.txt
reading manifest file 'sasl.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
writing manifest file 'sasl.egg-info/SOURCES.txt'
copying sasl/saslwrapper.cpp -> build/lib.macosx-10.7-x86_64-3.7/sasl
copying sasl/saslwrapper.h -> build/lib.macosx-10.7-x86_64-3.7/sasl
copying sasl/saslwrapper.pyx -> build/lib.macosx-10.7-x86_64-3.7/sasl
running build_ext
building 'sasl.saslwrapper' extension
creating build/temp.macosx-10.7-x86_64-3.7
creating build/temp.macosx-10.7-x86_64-3.7/sasl
gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/Users/jiang/anaconda3/include -arch x86_64 -I/Users/jiang/anaconda3/include -arch x86_64 -Isasl -I/Users/jiang/anaconda3/include/python3.7m -c sasl/saslwrapper.cpp -o build/temp.macosx-10.7-x86_64-3.7/sasl/saslwrapper.o
clang: warning: include path for libstdc++ headers not found; pass '-stdlib=libc++' on the command line to use the libc++ standard library instead [-Wstdlibcxx-not-found]
sasl/saslwrapper.cpp:249:10: fatal error: 'string' file not found
#include <string>
^~~~~~~~
1 error generated.
error: command 'gcc' failed with exit status 1
----------------------------------------
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
Complete output from command /Users/jiang/anaconda3/bin/python -u -c "import setuptools, tokenize;__file__='/private/var/folders/dh/lz2xjpzn5wqdhp6xtbrng_z00000gn/T/pip-install-ykoaejda/sasl/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /private/var/folders/dh/lz2xjpzn5wqdhp6xtbrng_z00000gn/T/pip-record-nkav6rd6/install-record.txt --single-version-externally-managed --compile:
running install
running build
running build_py
creating build
creating build/lib.macosx-10.7-x86_64-3.7
creating build/lib.macosx-10.7-x86_64-3.7/sasl
copying sasl/__init__.py -> build/lib.macosx-10.7-x86_64-3.7/sasl
running egg_info
writing sasl.egg-info/PKG-INFO
writing dependency_links to sasl.egg-info/dependency_links.txt
writing requirements to sasl.egg-info/requires.txt
writing top-level names to sasl.egg-info/top_level.txt
reading manifest file 'sasl.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
writing manifest file 'sasl.egg-info/SOURCES.txt'
copying sasl/saslwrapper.cpp -> build/lib.macosx-10.7-x86_64-3.7/sasl
copying sasl/saslwrapper.h -> build/lib.macosx-10.7-x86_64-3.7/sasl
copying sasl/saslwrapper.pyx -> build/lib.macosx-10.7-x86_64-3.7/sasl
running build_ext
building 'sasl.saslwrapper' extension
creating build/temp.macosx-10.7-x86_64-3.7
creating build/temp.macosx-10.7-x86_64-3.7/sasl
gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/Users/jiang/anaconda3/include -arch x86_64 -I/Users/jiang/anaconda3/include -arch x86_64 -Isasl -I/Users/jiang/anaconda3/include/python3.7m -c sasl/saslwrapper.cpp -o build/temp.macosx-10.7-x86_64-3.7/sasl/saslwrapper.o
clang: warning: include path for libstdc++ headers not found; pass '-stdlib=libc++' on the command line to use the libc++ standard library instead [-Wstdlibcxx-not-found]
sasl/saslwrapper.cpp:249:10: fatal error: 'string' file not found
#include <string>
^~~~~~~~
1 error generated.
error: command 'gcc' failed with exit status 1
解决办法,亲测有效
pip install git+https://github.com/JoshRosen/python-sasl.git@fix-build-with-newer-xcode
安装结果
Collecting git+https://github.com/JoshRosen/python-sasl.git@fix-build-with-newer-xcode
Cloning https://github.com/JoshRosen/python-sasl.git (to revision fix-build-with-newer-xcode) to /private/var/folders/dh/lz2xjpzn5wqdhp6xtbrng_z00000gn/T/pip-req-build-7idssui_
Requirement already satisfied: six in /Users/jiang/.local/lib/python3.7/site-packages (from sasl==0.2.1) (1.15.0)
Building wheels for collected packages: sasl
Running setup.py bdist_wheel for sasl ... done
Stored in directory: /private/var/folders/dh/lz2xjpzn5wqdhp6xtbrng_z00000gn/T/pip-ephem-wheel-cache-ghqp6fm8/wheels/d6/9a/bf/25ab3aaf3fb90796e50660cc6188c30336a80736a3729c56ae
Successfully built sasl
Installing collected packages: sasl
Successfully installed sasl-0.2.1