spark版本spark-2.1.1-bin-hadoop2.7
jdk1.8
python 3.6
参考:http://www.jianshu.com/p/5701591bfc70
测试代码:
from pyspark import SparkContext, SparkConf
logFile = 'C:\\Python\\Python36\\Lib\\site-packages\\README.txt'
conf = SparkConf().setMaster("local[*]").setAppName("Fisrt")
sc = SparkContext(conf=conf)
logData = sc.textFile(logFile).cache()
numAs = logData.filter(lambda s: 'a' in s).count()
numBs = logData.filter(lambda s: 'b' in s).count()
print('Lines with a :%i, lines with b: %i' % (numAs, numBs))

本文介绍了在Windows7系统中,使用PyCharm搭建Spark Python开发环境时遇到的问题及解决方法。当运行Spark测试代码时,出现'Java gateway process exited before sending the driver its port number'错误。解决方案包括确保使用正确版本的Spark(2.1.1)、JDK(1.8)和Python(3.6),以及避免JDK安装路径中存在空格或特殊符号。重新安装JDK到不含空格的路径(如C:Java)可解决此问题。

1304

被折叠的 条评论
为什么被折叠?



