Win10 Python3.6 安装impyla
-
安装依赖
-
pip install
six
-
pip install
bit_array
-
pip install
thrift
-
pip install thriftpy
-
pip install impyla
-
当安装依赖有vs的python包时,可能会出现以下错误:
PermissionError: [WinError 32] 另一个程序正在使用此文件,进程无法访问。: 'C:\\Users\\15875\\AppData\\Local\\Temp\\pip-build-h3ir43bb\\murmurhash'
因为windowns下的终端显示用的还是gbk编码,所以还得修改pip的源代码
根据报错信息,找到 D:\Python36\Lib\site-packages\pip-7.1.0-py3.6.egg\pip\compat\__init__.py
第49行
f sys.version_info >= (3,):
def console_to_str(s):
try:
return s.decode(sys.__stdout__.encoding)
except UnicodeDecodeError:
return s.decode('utf_8
')
把return s.decode('utf_8')
改为return s.decode('cp936')
即可。
安装成功后
执行代码
from impala.dbapi import connect
conn = connect(host='my.host.com', port=21050)
cursor = conn.cursor()
cursor.execute('SELECT * FROM mytable LIMIT 100')
print cursor.description # prints the result set's schema
results = cursor.fetchall()
报错
File
import happybase
File "D:\Program Files\python3.6\lib\site-packages\happybase\__init__.py", line 10, in <module>
'Hbase_thrift')
File "D:\Program Files\python3.6\lib\site-packages\thriftpy\parser\__init__.py", line 30, in load
include_dir=include_dir)
File "D:\Program Files\python3.6\lib\site-packages\thriftpy\parser\parser.py", line 496, in parse
url_scheme))
thriftpy.parser.exc.ThriftParserError: ThriftPy does not support generating module with path in protocol 'd'
ThriftParserError: ThriftPy does not support generating module with path in protocol 'd'
解决方法:
进入如下 你的Python的安装路径下,找到parser.py文件
D:\Program Files\python3.6\Lib\site-packages\thriftpy\parser
打开parser.py文件,找到488行。注释掉原来488行代码,添加为
if len(url_scheme) <= 1:
或者可以修改为 if url_scheme in ('f', ''):
如果是报错’d’上面就写’d’,‘f’就写’f’
#if url_scheme == '':
if url_scheme in ('d', 'c','','e','f'):
with open(path) as fh:
data = fh.read()
elif url_scheme in ('http', 'https'):
data = urlopen(path).read()
else:
raise ThriftParserError('ThriftPy does not support generating module '
'with path in protocol \'{}\''.format(
url_scheme))
问题原因
原因:happybase1.0在win下不支持绝对路径
具体原因:happybase要读取Python\Lib\site-packages\happybase\Hbase.thrift,但在Python\Lib\site-packages\thriftpy\parser\parser.py中的487行
path是Hbase.thrift的绝对路径(我的是“F:\SoftWare\Python27\Lib\site-packages\happybase\Hbase.thrift”),但经过urlparse(path).scheme后,url_scheme变成了“f”,(这也就是报错信息中最后的“f”)。根据代码,url_scheme既不为“”,也不包含
(‘http’,’https’),则只能为raise报错。
推荐阅读
-
Win10系统安装教程: 最靠谱Win10重置与重装系统详细图文教程
-
设置界面直接安装字体 Win10 19H1新功能体验
-
来自微软的礼物 教你安装Win10猪年免费主题
-
AutoCAD Mechanical 2013 WIN10系统环境下安装教程详细图解
-
Qt最新版5.12.2在Win10环境静态编译安装和部署的完整过程(VS2017)
-
Win10“抽风”为用户强行安装Office程序遭炮轰 微软回应称已叫停
-
Win10新版全面删除Flash:已从控制面板和安装文件中消失
-
你遇到没?Win10遭炮轰:自行重启并强制安装Office程序
-
Win10创造者更新预览版15014怎么下载安装新主题?
-
Win10安装VS2013中文语言包安装失败问题汇总