问题描述
因为我的 ipython3 笔记本中有这个问题,我想我必须以某种方式更改spark-env.sh.template".
Because i have this issue in my ipython3 notebook, i guess i have to change "spark-env.sh.template" somehow.
例外:worker 中的 Python 2.7 版本与驱动程序 3.4 中的版本不同,PySpark 无法在不同的次要版本下运行
Exception: Python in worker has different version 2.7 than that in driver 3.4, PySpark cannot run with different minor versions
推荐答案
Spark 尚不能与 Python 3 配合使用.如果您希望使用 Python API,您还需要一个 Python 解释器(2.6 版或更高版本).
Spark does not yet work with Python 3.If you wish to use the Python API you will also need a Python interpreter (version 2.6 or newer).
我在运行 IPYTHON=1 ./pyspark
时遇到了同样的问题.
I had the same issue when running IPYTHON=1 ./pyspark
.
好的快速修复
编辑 vim pyspark
并将 PYSPARK_DRIVER_PYTHON="ipython"
行更改为
Edit vim pyspark
and change PYSPARK_DRIVER_PYTHON="ipython"
line to
PYSPARK_DRIVER_PYTHON="ipython2"
就是这样.
如果你想检查剂量 ipython
指向哪里,
If you want to check where dose ipython
points to,
在终端输入 which ipython
我敢打赌那会是
Type which ipython
in terminal and I bet that'll be
/Library/Frameworks/Python.framework/Versions/3.4/bin/ipython
**更新**
最新版本的 spark 可以很好地与 python 3 配合使用.所以最新版本可能不需要.
The latest version of spark works well with python 3. So this may not need with the latest version.
只需设置环境变量:
导出 PYSPARK_PYTHON=python3
如果您希望此更改永久生效,请将此行添加到 pyspark 脚本
in case you want this change to be permanent add this line to pyspark script
这篇关于我如何使用 spark-env.sh.template 在 Python 3 中设置 Pyspark的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!