py4j.protocol.Py4JError: org.apache.spark.api.python.PythonUtils... does not exist in the JVM

废话不多说,解决办法:

#pip安装findspark
pip install findspark
#在程序中添加一以下代码
import findspark
findspark.init()

问题解决:
在这里插入图片描述

主要报错信息:

py4j.protocol.Py4JNetworkError: Error while receiving
ERROR:py4j.java_gateway:An error occurred while trying to connect to the Java server (127.0.0.1:59912)

完整报错信息:

D:\Anaconda\python.exe F:/pythonworkspace/mypyspark/test0416.py
Traceback (most recent call last):
  File "F:/pythonworkspace/mypyspark/test0416.py", line 8, in <module>
    sc = SparkContext("local","first app")
  File "D:\Anaconda\lib\site-packages\pyspark\context.py", line 136, in __init__
    conf, jsc, profiler_cls)
  File "D:\Anaconda\lib\site-packages\pyspark\context.py", line 213, in _do_init
    self._encryption_enabled = self._jvm.PythonUtils.getEncryptionEnabled(self._jsc)
  File "D:\Anaconda\lib\site-packages\py4j\java_gateway.py", line 1487, in __getattr__
    "{0}.{1} does not exist in the JVM".format(self._fqn, name))
py4j.protocol.Py4JError: org.apache.spark.api.python.PythonUtils.getEncryptionEnabled does not exist in the JVM
�ɹ�: ����ֹ PID 10140 (���� PID 9080 �ӽ���)�Ľ��̡�
�ɹ�: ����ֹ PID 9080 (���� PID 14992 �ӽ���)�Ľ��̡�
�ɹ�: ����ֹ PID 14992 (���� PID 8740 �ӽ���)�Ľ��̡�
ERROR:root:Exception while sending command.
Traceback (most recent call last):
  File "D:\Anaconda\lib\site-packages\py4j\java_gateway.py", line 1152, in send_command
    answer = smart_decode(self.stream.readline()[:-1])
  File "D:\Anaconda\lib\socket.py", line 589, in readinto
    return self._sock.recv_into(b)
ConnectionResetError: [WinError 10054] 远程主机强迫关闭了一个现有的连接。

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "D:\Anaconda\lib\site-packages\py4j\java_gateway.py", line 985, in send_command
    response = connection.send_command(command)
  File "D:\Anaconda\lib\site-packages\py4j\java_gateway.py", line 1164, in send_command
    "Error while receiving", e, proto.ERROR_ON_RECEIVE)
py4j.protocol.Py4JNetworkError: Error while receiving
ERROR:py4j.java_gateway:An error occurred while trying to connect to the Java server (127.0.0.1:59912)
Traceback (most recent call last):
  File "D:\Anaconda\lib\site-packages\py4j\java_gateway.py", line 929, in _get_connection
    connection = self.deque.pop()
IndexError: pop from an empty deque

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "D:\Anaconda\lib\site-packages\py4j\java_gateway.py", line 1067, in start
    self.socket.connect((self.address, self.port))
ConnectionRefusedError: [WinError 10061] 由于目标计算机积极拒绝,无法连接。

Process finished with exit code 1

  • 2
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 2
    评论
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值