我开始使用pyspark,已安装它并在jupyter-notebook上运行,这是我面临的有关网关进程失败的问题。我什至尝试设置$ JAVA_HOME,但是没有用。我想知道背后的原因是什么以及如何解决它。
jupyter-notebook中的错误
Exception: Java gateway process exited before sending its port number
.bashrc文件
export PYTHONPATH=/usr/lib/python3.6
export SPARK_HOME='/home/junaid/spark-2.4.0-bin-hadoop2.7'
export PATH=$SPARK_HOME:$PATH
export PYTHONPATH=$SPARK_HOME/python:$PYTHONPATH
export PYSPARK_PYTHON=python3
export PYSPARK_DRIVER_PYTHON=jupyter
export PYSPARK_DRIVER_PYTHON_OPTS='notebook'
export HADOOP_HOME=$HOME/hadoop-2.7.3
export HADOOP_CONF_DIR=$HOME/hadoop-2.7.3/etc/hadoop
export HADOOP_MAPRED_HOME=$HOME/hadoop-2.7.3
export HADOOP_COMMON_HOME=$HOME/hadoop-2.7.3
export HADOOP_HDFS_HOME=$HOME/hadoop-2.7.3
export YARN_HOME=$HOME/hadoop-2.7.3
export PATH=$PATH:$HOME/hadoop-2.7.3/bin
export JAVA_HOME=/usr/lib/jvm/java-8-oracle/
export PATH="$PATH:/opt/mssql-tools/bin"
笔记本代码
from pyspark import SparkContext
sc = SparkContext("local")
我什至尝试过
sc = SparkContext("local", "count app")
但是没有用。