错误:raise RuntimeError("Java gateway process exited before sending its port number")
RuntimeError: Java gateway process exited before sending its port number
如图:
代码:
# 导包
from pyspark import SparkConf,SparkContext
# 创建SparkConf类对象
conf = SparkConf().setMaster("local[*]").setAppName("test_spark_app")
# 基于Spark类对象创建SparkContext对象
sc = SparkContext()
# 打印PySpark的运行版本
print(sc.version)
# 停止SparkContext对象的运行(停止PySark程序)
sc.stop()