Google Colab Notebook中的PySpark运行问题

问题描述

在colab笔记本中运行以下代码后:

import findspark
findspark.init("E:/spark-3.0.1-bin-hadoop2.7")

import pyspark

出现此错误

/usr/local/lib/python3.6/dist-packages/findspark.py in init(spark_home,python_path,edit_rc,edit_profile)
    142     try:
--> 143         py4j = glob(os.path.join(spark_python,"lib","py4j-*.zip"))[0]
    144     except IndexError:

IndexError: list index out of range

During handling of the above exception,another exception occurred:

Exception                                 Traceback (most recent call last)
1 frames
/usr/local/lib/python3.6/dist-packages/findspark.py in init(spark_home,edit_profile)
    144     except IndexError:
    145         raise Exception(
--> 146             "Unable to find py4j,your SPARK_HOME may not be configured correctly"
    147         )
    148     sys.path[:0] = [spark_python,py4j]

Exception: Unable to find py4j,your SPARK_HOME may not be configured correctly

当我验证了spark文件夹时,我发现py4j模块已经存在!如下图所示: enter image description here

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...