创建于:20200802
修改于:20200802
win10 64bit
python3.6.6 (conda建立的虚拟环境)
下面是基本的安装过程,具体参照官网:
cloudera/impyla
我在PyCharm的Terminal下安装的。如pip install six
six
bit_array
thriftpy
#这样不依赖Microsoft Visual C++ 14.0
thrift_sasl==0.2.1 --no-deps
#这样不依赖Microsoft Visual C++ 14.0
pure-sasl
impyla
错误信息 error: Microsoft Visual C++ 14.0 is required. Get it with “Microsoft Visual C++ Build Tools”: http://landinghub.visualstudio.com/visual-cpp-build-tools
解决方案1 在windows下安装Visual Studio
安装地址:https://pan.baidu.com/s/1WaBxFghTll6Zofz1DGOZBg
原文地址:https://blog.csdn.net/qq_38316655/article/details/79417709
参考资料是python连接hive (安装impyla)的采坑之旅
解决方案2直接下载二进制安装包进行安装
二进制安装包下载地址:https://www.lfd.uci.edu/~gohlke/pythonlibs/#mysql-python
下载对应的whl文件:cp后面是python版本,amd64代表64位,点击s所需版本的whl文件下载。如下图。
使用 pip install 下载文件的完整路径名,进行安装。
进入whl所在文件夹,地址栏输入cmd;
或者
在conda prompt (以管理员身份打开)进入到相应的目录(这对于安装conda虚拟环境的适用)
比如: pip install C:\Users\jc\Desktop\Twisted-18.4.0-cp36-cp36m-win_amd64.whl
参考链接:
pip安装scrapy失败:twisted安装失败 error: Microsoft Visual C++ 14.0 is required… 解决方法
# python 3.6.6
from impala.dbapi import connect
def connect(host='localhost', port=21050, database=None, timeout=None,
use_ssl=False, ca_cert=None, auth_mechanism='NOSASL', user=None,
password=None, kerberos_service_name='impala', use_ldap=None,
ldap_user=None, ldap_password=None, use_kerberos=None,
protocol=None, krb_host=None, use_http_transport=False,
http_path=''):
"""Get a connection to HiveServer2 (HS2).
These options are largely compatible with the impala-shell command line
arguments. See those docs for more information.
Parameters
----------
host : str
The hostname for HS2. For Impala, this can be any of the `impalad`s.
port : int, optional
The port number for HS2. The Impala default is 21050. The Hive port is
likely different.
database : str, optional
The default database. If `None`, the result is
implementation-dependent.
timeout : int, optional
Connection timeout in seconds. Default is no timeout.
use_ssl : bool, optional
Enable SSL.
ca_cert : str, optional
Local path to the the third-party CA certificate. If SSL is enabled but
the certificate is not specified, the server certificate will not be
validated.
auth_mechanism : {'NOSASL', 'PLAIN', 'GSSAPI', 'LDAP'}
Specify the authentication mechanism. `'NOSASL'` for unsecured Impala.
`'PLAIN'` for unsecured Hive (because Hive requires the SASL
transport). `'GSSAPI'` for Kerberos and `'LDAP'` for Kerberos with
LDAP.
user : str, optional
LDAP user, if applicable.
password : str, optional
LDAP password, if applicable.
kerberos_service_name : str, optional
Authenticate to a particular `impalad` service principal. Uses
`'impala'` by default.
use_ldap : bool, optional
Specify `auth_mechanism='LDAP'` instead.
.. deprecated:: 0.11.0
ldap_user : str, optional
Use `user` parameter instead.
.. deprecated:: 0.11.0
ldap_password : str, optional
Use `password` parameter instead.
.. deprecated:: 0.11.0
use_kerberos : bool, optional
Specify `auth_mechanism='GSSAPI'` instead.
.. deprecated:: 0.11.0
protocol : str, optional
Do not use. HiveServer2 is the only protocol currently supported.
.. deprecated:: 0.11.0
Returns
-------
HiveServer2Connection
A `Connection` object (DB API 2.0-compliant).
"""
Win10 Python3.6 安装impyla
python连接impala(安装impyla)
windows7下给python3安装impyla的艰辛历程
Windows下Python3安装impyla
Win7平台Python3使用impyla连接Hive遇到的坑