How to specify the version of Python for spark-submit to use?

前端 未结 4 1122
南笙
南笙 2021-02-06 23:45

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

4条回答
  •  太阳男子
    2021-02-06 23:54

    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.

提交回复
热议问题