python pyhs2 的安装操作


Posted in Python onApril 07, 2021

我就废话不多说了,大家还是直接看代码吧~

# 两个依赖包: sasl&thrift
The easier way I find to install sasl on windows 7 is to use the pre-compiled version from here : http://www.lfd.uci.edu/~gohlke/pythonlibs/
There is a direct link to the sasl librairies here : http://www.lfd.uci.edu/~gohlke/pythonlibs/#sasl just pick the one you need.
Then you install it using pip :
pip install sasl-0.1.3-cp27-none-win_amd64.whl
 
from setuptools import setup
setup(
  name='pyhs2',
  version='0.6.0',
  author='Brad Ruderman',
  author_email='bradruderman@gmail.com',
  packages=['pyhs2', 'pyhs2/cloudera', 'pyhs2/TCLIService'],
  url='https://github.com/BradRuderman/pyhs2',
  license='LICENSE.txt',
  description='Python Hive Server 2 Client Driver',
  long_description=open('README.md').read(),
  install_requires=[
    "sasl",
    "thrift",
  ],
  test_suite='pyhs2.test',
  tests_require=["mock"]
)

补充:windows7下给python3安装impyla的艰辛历程

安装环境标题已经给出了,linux下和python2下都很容易安装,我也不知道为什么python3反而这么蛋疼。就直接上干货吧,希望其他人少走弯路。

安装所需依赖

pip install ipython six bit_array thriftpy thrift_sasl==0.2.1 sasl impyla(admin下)

常见报错

error: command ‘C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\x86_amd64\link.exe' failed with exit status 1158

FileExistsError: [WinError 183] 当文件已存在时,无法创建该文件。

LINK : fatal error LNK1158: cannot run ‘rc.exe'

大致错误分析

一般上面的报错会出现在安装sasl ,thrift_sasl,和Bitarray时,推测是源码安装时pip与windows的兼容性问题,这时可以用二进制文件安装,参考https://stackoverflow.com/questions/44315943/error-installing-scrapy-error-command-c-program-files-x86-microsoft-visu中第一个回答下的第二条回复

解决办法

https://www.lfd.uci.edu/~gohlke/pythonlibs/找到依赖的包的二进制whl文件进行安装,区分cp36和cp37的,然后一个个安装,遇到哪个依赖库报错就在这个网站中找,用它们的包进行安装即可

3/20更新

这几天又发现了新问题:

1. 在重新安装开发环境时出现了

thriftpy.parser.exc.ThriftParserError: ThriftPy does not support generating module with path in protocol 'c'

2. 在linux上安装sasl这个库时,会出现依赖报错:error: command 'gcc' failed with exit status 1

感觉着实蛋疼,最后才找到了一劳永逸的解决办法,即使用anaconda安装impyla即可自动解决依赖问题:

conda install -c anaconda impyla

有时安装完impyla后还是会报thrift_sasl不存在的错误,可以用conda install -c anaconda thrift_sasl==0.2.1即可

参考:https://stackoverflow.com/questions/39220102/error-import-impyla-library-on-windows

以上为个人经验,希望能给大家一个参考,也希望大家多多支持三水点靠木。如有错误或未考虑完全的地方,望不吝赐教。

Python 相关文章推荐
Django中几种重定向方法
Apr 28 Python
从Python的源码来解析Python下的freeblock
May 11 Python
python实现中文分词FMM算法实例
Jul 10 Python
python基础教程项目五之虚拟茶话会
Apr 02 Python
python中将一个全部为int的list 转化为str的list方法
Apr 09 Python
python 使用poster模块进行http方式的文件传输到服务器的方法
Jan 15 Python
django框架基于模板 生成 excel(xls) 文件操作示例
Jun 19 Python
python如何制作英文字典
Jun 25 Python
详解python播放音频的三种方法
Sep 23 Python
Python实现井字棋小游戏
Mar 09 Python
python使用numpy中的size()函数实例用法详解
Jan 29 Python
Python Django项目和应用的创建详解
Nov 27 Python
python3 sqlite3限制条件查询的操作
Apr 07 #Python
python实现高效的遗传算法
解决hive中导入text文件遇到的坑
Apr 07 #Python
python - asyncio异步编程
Apr 06 #Python
python - timeit 时间模块
Apr 06 #Python
python制作图形界面的2048游戏, 基于tkinter
python第三方网页解析器 lxml 扩展库与 xpath 的使用方法
Apr 06 #Python
You might like
php目录操作函数之获取目录与文件的类型
2010/12/29 PHP
初品cakephp 入门基础
2012/02/16 PHP
php通过function_exists检测函数是否存在的方法
2015/03/18 PHP
PHP date_default_timezone_set()设置时区操作实例分析
2020/05/16 PHP
XmlUtils JS操作XML工具类
2009/10/01 Javascript
jquery通过a标签删除table中的一行的代码
2013/12/02 Javascript
Windows下用PyCharm和Visual Studio开始Python编程
2015/10/26 Javascript
JavaScript文档碎片操作实例分析
2015/12/12 Javascript
jQuery实现布局高宽自适应的简单实例
2016/05/28 Javascript
在vue中,v-for的索引index在html中的使用方法
2018/03/06 Javascript
基于JavaScript canvas绘制贝塞尔曲线
2018/12/25 Javascript
操作按钮悬浮固定在微信小程序底部的实现代码
2019/08/02 Javascript
nodejs一个简单的文件服务器的创建方法
2019/09/13 NodeJs
vue表单中遍历表单操作按钮的显示隐藏示例
2019/10/30 Javascript
浅谈vue中get请求解决传输数据是数组格式的问题
2020/08/03 Javascript
[41:12]Liquid vs Secret 2019国际邀请赛淘汰赛 败者组 BO3 第一场 8.24
2019/09/10 DOTA
分享一下Python 开发者节省时间的10个方法
2015/10/02 Python
Python批量修改文本文件内容的方法
2016/04/29 Python
ansible作为python模块库使用的方法实例
2017/01/17 Python
在CMD命令行中运行python脚本的方法
2018/05/12 Python
快速解决PyCharm无法引用matplotlib的问题
2018/05/24 Python
django 实现编写控制登录和访问权限控制的中间件方法
2019/01/15 Python
Python从list类型、range()序列简单认识类(class)【可迭代】
2019/05/31 Python
15行Python代码实现免费发送手机短信推送消息功能
2020/02/27 Python
详解pycharm的python包opencv(cv2)无代码提示问题的解决
2021/01/29 Python
解决tensorflow模型压缩的问题_踩坑无数,总算搞定
2021/03/02 Python
使用CSS3制作响应式导航菜单的方法
2015/07/12 HTML / CSS
捷克鲜花配送:Florea.cz
2018/10/29 全球购物
护士个人简历自荐信
2013/10/18 职场文书
大学生第一学年自我鉴定
2014/09/12 职场文书
融资合作协议书范本
2014/10/17 职场文书
先进个人申报材料
2014/12/30 职场文书
校长师德表现自我评价
2015/03/05 职场文书
新郎结婚感言
2015/07/31 职场文书
会议开幕致辞怎么写
2016/03/03 职场文书
大学生党员暑假实践(活动总结)
2019/08/21 职场文书