我试图在我的macbook上运行pyspark.当我尝试启动它,我得到错误:
Exception: Java gateway process exited before sending the driver its port number
当sc = SparkContext()在启动时被调用.我尝试运行以下命令:
./bin/pyspark ./bin/spark-shell export PYSPARK_SUBMIT_ARGS="--master local[2] pyspark-shell"
没有用.我也看过这里:
Spark + Python – Java gateway process exited before sending the driver its port number?
但问题从未得到解决.请帮忙!谢谢.
解决方法
这应该会帮助你
一个解决方案是将pyspark-shell添加到shell环境变量PYSPARK_SUBMIT_ARGS中:
export PYSPARK_SUBMIT_ARGS="--master local[2] pyspark-shell"
python / pyspark / java_gateway.py有一个变化,如果用户设置了PYSPARK_SUBMIT_ARGS变量,则需要PYSPARK_SUBMIT_ARGS包含pyspark-shell.