如何在python中安装与使用pyhs2

发布时间:2021-04-07 15:36:13 作者:Leah
来源:亿速云 阅读:266

本篇文章给大家分享的是有关如何在python中安装与使用pyhs2,小编觉得挺实用的,因此分享给大家学习,希望大家阅读完这篇文章后可以有所收获,话不多说,跟着小编一起来看看吧。

# 两个依赖包: 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

以上就是如何在python中安装与使用pyhs2,小编相信有部分知识点可能是我们日常工作会见到或用到的。希望你能通过这篇文章学到更多知识。更多详情敬请关注亿速云行业资讯频道。

推荐阅读:
  1. 如如何使用journalctl命令?
  2. Python中pip如何安装与使用

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

python pyhs2

上一篇:如何在python3中使用sqlite3限制条件查询

下一篇:怎么在MySQL中安装infobright

相关阅读

您好,登录后才能下订单哦!

密码登录
登录注册
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》