How to run a script in PySpark

匿名 (未验证) 提交于 2019-12-03 08:41:19

问题:

I'm trying to run a script in the pyspark environment but so far I haven't been able to. How can I run a script like python script.py but in pyspark? Thanks

回答1:

You can do: ./bin/spark-submit mypythonfile.py

Running python applications through pyspark is not supported as of Spark 2.0.



回答2:

pyspark 2.0 and later execute script file in environment variable PYTHONSTARTUP, so you can run:

PYTHONSTARTUP=code.py pyspark 

Compared to spark-submit answer this is useful for running initialization code before using the interactive pyspark shell.



回答3:

Just spark-submit mypythonfile.py should be enough.



标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!