【发布时间】:2020-06-13 22:53:25
【问题描述】:
我正在尝试在 Win10 虚拟机上与 Python 一起学习 Spark。为此,我正在尝试使用 PySpark 从 CSV 文件中读取数据,但会停止以下操作:
C:\Users\israel\AppData\Local\Programs\Python\Python37\python.exe C:/Users/israel/Desktop/airbnb_python/src/main/python/spark_python/airbnb.py
你好世界1
系统找不到指定路线
我已阅读 How to link PyCharm with PySpark? , PySpark, Win10 - The system cannot find the path specified , The system cannot find the path specified error while running pyspark , PySpark - The system cannot find the path specified 但还没有找到实施解决方案的运气。
我正在使用 IntelliJ,python 3.7。这是运行配置。
我正在使用 IntelliJ,python 3.7。代码如下
from pyspark.sql import SparkSession
from pyspark.sql import Row
from pyspark.sql.types import *
if __name__ == "__main__":
print("hello world1")
spark = SparkSession \
.builder \
.appName("spark_python") \
.master("local") \
.getOrCreate()
print("hello world2")
path = "C:\\Users\\israel\\Desktop\\data\\listings.csv"
df = spark.read\
.format("csv")\
.option("header", "true")\
.option("inferSchema", "true")\
.load(path)
df.show()
spark.stop()
似乎错误出现在 SparkSession 中,但我看不出宣布的错误与该行有什么关系。值得一提的是,执行永远不会结束,我必须手动停止执行才能重新运行。谁能告诉我我做错了什么?请
【问题讨论】:
-
您检查过
SPARK_HOME、HADOOP_HOME和JAVA_HOME的路径吗?它们都正确吗? -
是的,它们是最后一张图片
标签: python apache-spark intellij-idea pyspark