问题描述
我正在使用Pyspark在Jupyter Notebook中运行一些命令,但是会引发错误.我尝试了此链接中提供的解决方案( Pyspark:例外:在发送驱动程序端口号之前退出Java网关进程)并且我尝试执行此处提供的解决方案(例如,更改C:Java的路径,卸载Java SDK 10并重新安装Java 8,但仍然会引发相同的错误.
I am using Pyspark to run some commands in Jupyter Notebook but it is throwing error. I tried solutions provided in this link (Pyspark: Exception: Java gateway process exited before sending the driver its port number)and I tried doing the solution provided here (such as Changing the path to C:Java, Uninstalling Java SDK 10 and reinstalling Java 8, still it is throwing me the same error.
我尝试卸载并重新安装pyspark,并且尝试从anaconda提示符运行,但仍然遇到相同的错误.我正在使用python 3.7和pyspark版本是2.4.0.
I tried uninstalling and reinstalling pyspark, and I tried running from anaconda prompt as well still I am getting the same error. I am using Python 3.7 and pyspark version is 2.4.0.
如果使用此代码,则会出现此错误.异常:Java网关进程在发送其端口号之前已退出".
If I use this code, I get this error."Exception: Java gateway process exited before sending its port number".
from pyspark import SparkContext
from pyspark.sql import SQLContext
sc = SparkContext()
sqlContext = SQLContext(sc)
from pyspark.mllib.linalg import Vector, Vectors
from nltk.stem.wordnet import WordNetLemmatizer
from pyspark.ml.feature import RegexTokenizer, StopWordsRemover, Word2Vec
但是,如果我从此代码中删除sparkcontext可以正常运行,但我的解决方案将需要spark上下文.下面没有Spark上下文的代码不会引发任何错误.
But If I remove sparkcontext from this code runs fine, but I would need spark context for my solution. Below code without spark context does not throw any error.
from pyspark import SparkContext
from pyspark.sql import SQLContext
from pyspark.mllib.linalg import Vector, Vectors
from nltk.stem.wordnet import WordNetLemmatizer
from pyspark.ml.feature import RegexTokenizer, StopWordsRemover, Word2Vec
如果能得到解决的帮助,我将不胜感激.我正在使用Windows 10 64位操作系统.
I would appreciate if I could get any help figuring this out. I am using Windows 10 64 bit operating system.
这里是完整的错误代码图片.
Here is full error code picture.
推荐答案
尝试一下
sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java8-installer
使用linux为我工作.它也适用于Windows
Worked for me using linux.It should work for windows too
此链接将帮助您,因为您是Windows用户 https://superuser.com/questions/947220/how-to-install-packages-apt-get-install-in-windows
this link will help you for coz you are an windows user https://superuser.com/questions/947220/how-to-install-packages-apt-get-install-in-windows
这篇关于Pyspark错误:在发送其端口号之前,Java网关进程已退出的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!