当前位置:首页 » python教程 » 正文

python pyhs2 的安装操作

看: 1178次  时间:2021-05-14  分类 : python教程

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

# 两个依赖包: 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博客。如有错误或未考虑完全的地方,望不吝赐教。

标签:scrapy  

<< 上一篇 下一篇 >>

搜索

推荐资源

  Powered By python教程网   鲁ICP备18013710号
python博客 - 小白学python最友好的网站!