明白这是一个经常被问到的问题,但我已经设置了我的环境和东西(附图片)。运行windows10需要pyspark作为课程模块。请帮忙。。。
运行后的错误消息:
import pyspark
from pyspark.sql import SparkSession
spark = SparkSession.builder.config("spark-master","local").getOrCreate()
以下是回溯:
Exception Traceback (most recent call last)
<ipython-input-3-12e393ff7f76> in <module>
1 import pyspark
2 from pyspark.sql import SparkSession
----> 3 spark = SparkSession.builder.config("spark-master","local").getOrCreate()
C:\opt\spark\spark-2.4.6-bin-hadoop2.7\python\pyspark\sql\session.py in getOrCreate(self)
171 for key, value in self._options.items():
172 sparkConf.set(key, value)
--> 173 sc = SparkContext.getOrCreate(sparkConf)
174 # This SparkContext may be an existing one.
175 for key, value in self._options.items():
C:\opt\spark\spark-2.4.6-bin-hadoop2.7\python\pyspark\context.py in getOrCreate(cls, conf)
365 with SparkContext._lock:
366 if SparkContext._active_spark_context is None:
--> 367 SparkContext(conf=conf or SparkConf())
368 return SparkContext._active_spark_context
369
C:\opt\spark\spark-2.4.6-bin-hadoop2.7\python\pyspark\context.py in __init__(self, master, appName, sparkHome, pyFiles, environment, batchSize, serializer, conf, gateway, jsc, profiler_cls)
131 " note this option will be removed in Spark 3.0")
132
--> 133 SparkContext._ensure_initialized(self, gateway=gateway, conf=conf)
134 try:
135 self._do_init(master, appName, sparkHome, pyFiles, environment, batchSize, serializer,
C:\opt\spark\spark-2.4.6-bin-hadoop2.7\python\pyspark\context.py in _ensure_initialized(cls, instance, gateway, conf)
314 with SparkContext._lock:
315 if not SparkContext._gateway:
--> 316 SparkContext._gateway = gateway or launch_gateway(conf)
317 SparkContext._jvm = SparkContext._gateway.jvm
318
C:\opt\spark\spark-2.4.6-bin-hadoop2.7\python\pyspark\java_gateway.py in launch_gateway(conf)
44 :return: a JVM gateway
45 """
---> 46 return _launch_gateway(conf)
47
48
C:\opt\spark\spark-2.4.6-bin-hadoop2.7\python\pyspark\java_gateway.py in _launch_gateway(conf, insecure)
106
107 if not os.path.isfile(conn_info_file):
--> 108 raise Exception("Java gateway process exited before sending its port number")
109
110 with open(conn_info_file, "rb") as info:
Exception: Java gateway process exited before sending its port number
暂无答案!
目前还没有任何答案,快来回答吧!