溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊(cè)×
其他方式登錄
點(diǎn)擊 登錄注冊(cè) 即表示同意《億速云用戶服務(wù)條款》

如何在python中安裝與使用pyhs2

發(fā)布時(shí)間:2021-04-07 15:36:13 來源:億速云 閱讀:296 作者:Leah 欄目:開發(fā)技術(shù)

本篇文章給大家分享的是有關(guān)如何在python中安裝與使用pyhs2,小編覺得挺實(shí)用的,因此分享給大家學(xué)習(xí),希望大家閱讀完這篇文章后可以有所收獲,話不多說,跟著小編一起來看看吧。

# 兩個(gè)依賴包: 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"]
)

補(bǔ)充:windows7下給python3安裝impyla的艱辛歷程

安裝環(huán)境標(biāo)題已經(jīng)給出了,linux下和python2下都很容易安裝,我也不知道為什么python3反而這么蛋疼。就直接上干貨吧,希望其他人少走彎路。

安裝所需依賴

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

常見報(bào)錯(cuò)

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] 當(dāng)文件已存在時(shí),無法創(chuàng)建該文件。

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

大致錯(cuò)誤分析

一般上面的報(bào)錯(cuò)會(huì)出現(xiàn)在安裝sasl ,thrift_sasl,和Bitarray時(shí),推測是源碼安裝時(shí)pip與windows的兼容性問題,這時(shí)可以用二進(jìn)制文件安裝,參考https://stackoverflow.com/questions/44315943/error-installing-scrapy-error-command-c-program-files-x86-microsoft-visu中第一個(gè)回答下的第二條回復(fù)

解決辦法

上https://www.lfd.uci.edu/~gohlke/pythonlibs/找到依賴的包的二進(jìn)制whl文件進(jìn)行安裝,區(qū)分cp36和cp37的,然后一個(gè)個(gè)安裝,遇到哪個(gè)依賴庫報(bào)錯(cuò)就在這個(gè)網(wǎng)站中找,用它們的包進(jìn)行安裝即可

3/20更新

這幾天又發(fā)現(xiàn)了新問題:

1. 在重新安裝開發(fā)環(huán)境時(shí)出現(xiàn)了

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

2. 在linux上安裝sasl這個(gè)庫時(shí),會(huì)出現(xiàn)依賴報(bào)錯(cuò):error: command 'gcc' failed with exit status 1

感覺著實(shí)蛋疼,最后才找到了一勞永逸的解決辦法,即使用anaconda安裝impyla即可自動(dòng)解決依賴問題:

conda install -c anaconda impyla

以上就是如何在python中安裝與使用pyhs2,小編相信有部分知識(shí)點(diǎn)可能是我們?nèi)粘9ぷ鲿?huì)見到或用到的。希望你能通過這篇文章學(xué)到更多知識(shí)。更多詳情敬請(qǐng)關(guān)注億速云行業(yè)資訊頻道。

向AI問一下細(xì)節(jié)

免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場,如果涉及侵權(quán)請(qǐng)聯(lián)系站長郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。

AI