如何指定供Spark提交使用的Python版本? [英] How to specify the version of Python for spark-submit to use?
问题描述
我有两个版本的Python.当我使用spark-submit启动spark应用程序时,该应用程序使用默认版本的Python.但是,我想使用另一个. 如何指定要用于Spark提交的Python版本?
您可以将conf/spark-env.sh
(在Spark的安装目录中)中的PYSPARK_PYTHON
变量设置为所需Python可执行文件的绝对路径.
Spark发行版默认包含spark-env.sh.template
(在Windows上为spark-env.cmd.template
).必须先将其重命名为spark-env.sh
(spark-env.cmd
).
例如,如果Python可执行文件安装在/opt/anaconda3/bin/python3
下:
PYSPARK_PYTHON='/opt/anaconda3/bin/python3'
有关详细信息,请参见配置文档./p>
I have two versions of Python. When I launch a spark application using spark-submit, the application uses the default version of Python. But, I want to use the other one. How to specify the version of Python for spark-submit to use?
You can set the PYSPARK_PYTHON
variable in conf/spark-env.sh
(in Spark's installation directory) to the absolute path of the desired Python executable.
Spark distribution contains spark-env.sh.template
(spark-env.cmd.template
on Windows) by default. It must be renamed to spark-env.sh
(spark-env.cmd
) first.
For example, if Python executable is installed under /opt/anaconda3/bin/python3
:
PYSPARK_PYTHON='/opt/anaconda3/bin/python3'
Check out the configuration documentation for more information.
这篇关于如何指定供Spark提交使用的Python版本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!