"D:\Program files\Anaconda2\python.exe" C:/Users/PycharmProjects/helloworld/spark1.py SPARK_HOME not in os.environ SPARK_JARS_DIR already set== D:\!spark-1.6.2\jars "set PYTHONHASHSEED=0" "run spark-class2.cmd" ϵͳ�Ҳ���ָ����·���� Failed to find Spark assembly JAR. You need to build Spark before running this program. Traceback (most recent call last): File "C:/Users/PycharmProjects/helloworld/spark1.py", line 70, in conf = SparkConf().setAppName(APP_NAME) # .setMaster("spark://10.120.21.80:8032") File "D:\Program files\Anaconda2\lib\site-packages\pyspark\conf.py", line 104, in __init__ SparkContext._ensure_initialized() File "D:\Program files\Anaconda2\lib\site-packages\pyspark\context.py", line 245, in _ensure_initialized SparkContext._gateway = gateway or launch_gateway() File "D:\Program files\Anaconda2\lib\site-packages\pyspark\java_gateway.py", line 94, in launch_gateway raise Exception("Java gateway process exited before sending the driver its port number")

Exception: Java gateway process exited before sending the driver its port number Process finished with exit code 1
  看到那斜杠不一的路径了吗?当你以为/和\是造成这个exception的关键的时候,其实关键问题并不是这个。配置pycharm打印出来的是乱码,是这个IDE的console没配置识别中文的问题。搜了一会儿没搜到怎么重整这个编码,之前在Java里实现一个console也发现了乱码问题,修理起来还是比较费劲的。
  好了,言归正传,这么多人遇到了 Java gateway process问题,说明是个非常头疼的问题。这个问题尤其头疼,是出现在配置windows下的PyCharm环境中。在windows下我也配置了Netbeans,能够成功跑通spark程序,没有任何问题,为什么到了PyCharm下就出毛病了呢?明明是同一个spark文件夹。结果,我发现,PyCharm,或者说pyspark环境,不能识别包含奇怪符号的目录
  我的路径D:\!bigdata\Spark里面有一个感叹号,然后,它就找不到jars了!!!!
  去掉这个感叹号,然后,它就好了!不报错了!
  所以, 不要 往spark 路径 里面添加奇怪的 标点符号
Logo

权威|前沿|技术|干货|国内首个API全生命周期开发者社区

更多推荐