windows7 + pycharm 搭建spark的python开发环境,Java gateway process exited before sending the driver its port

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))


报错:Java gateway process exited before sending the driver its port number 

jdk安装到了C:\Program Files\Java下

重新卸载jdk,安装到C:\Java下。

猜测:jdk路径中有空格、特殊符号都会有问题。

你可能感兴趣的:(spark)