如何在 HDP 中的 zeppelin-spark2 中将库安装到 python [英] How to install libraries to python in zeppelin-spark2 in HDP

查看:24
本文介绍了如何在 HDP 中的 zeppelin-spark2 中将库安装到 python的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用的是 HDP 版本:2.6.4

I am using HDP Version: 2.6.4

您能否提供有关如何将库安装到 spark2 下的以下 python 目录的分步说明?

Can you provide a step by step instructions on how to install libraries to the following python directory under spark2 ?

sc.version(spark 版本)返回

The sc.version (spark version) returns

res0: String = 2.2.0.2.6.4.0-91

spark2解释器名称和值如下

The spark2 interpreter name and value is as following

zeppelin.pyspark.python:    /usr/local/Python-3.4.8/bin/python3.4

python 版本和当前库是

The python version and current libraries are

%spark2.pyspark

import pip
import sys

sorted(["%s==%s" % (i.key, i.version) for i in pip.get_installed_distributions()])

print("--")     
print (sys.version)
print("--")
print(installed_packages_list)

--
3.4.8 (default, May 30 2018, 11:05:04) 
[GCC 4.4.7 20120313 (Red Hat 4.4.7-18)]
--
['pip==9.0.1', 'setuptools==28.8.0']

更新一:使用pip install [包名]其实会导致两个问题

1) HDP 指向 python2.6 而不是 python3.4.8

Update 1: using pip install [package name] actually leads to two problems

1) The HDP is pointing at python2.6 rather than python3.4.8

2) pip3 由于某种原因不在那里

2) pip3 is not there for some reason

因此,我正在考虑安装 miniconda 并将 Zeppelin 指向那里并在 conda 中安装所有软件包以防止 python 2.6 和 3.4.8 之间发生冲突

Therefore, I am thinking of installing miniconda and pointing Zeppelin there and installing all the packages in conda to prevent conflict between python 2.6 and 3.4.8

推荐答案

您需要打开终端并输入 pip 并按 TAB 键.应列出您沙箱上可用的 pip 版本.使用 pip3 安装您需要的软件包.这样做的方法保持不变 pip3 install "packageName".这将使您希望在 Zeppelin 中使用的 Python3 安装可以使用该包.

You need to open your terminal and type pip and press the TAB key. The pip versions available on your sandbox shall be listed. Use pip3 to install the packages you require. The way to do so remains the same pip3 install "packageName". This would make the package available with the Python3 installation you wish to use in Zeppelin.

这篇关于如何在 HDP 中的 zeppelin-spark2 中将库安装到 python的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆