【发布时间】:2018-03-18 10:00:27
【问题描述】:
我正在按照本教程here 使用 Spark 库为 python 编程配置 eclipse。我一步一步地跟着没有任何问题...
但是,一旦我执行了这个示例程序:
# Imports
# Take care about unused imports (and also unused variables),
# please comment them all, otherwise you will get any errors at the execution.
# Note that neither the directives "@PydevCodeAnalysisIgnore" nor "@UnusedImport"
# will be able to solve that issue.
#from pyspark.mllib.clustering import KMeans
from pyspark import SparkConf, SparkContext
import os
# Configure the Spark environment
sparkConf = SparkConf().setAppName("WordCounts").setMaster("local")
sc = SparkContext(conf = sparkConf)
# The WordCounts Spark program
textFile = sc.textFile(os.environ["SPARK_HOME"] + "/README.md")
wordCounts = textFile.flatMap(lambda line: line.split()).map(lambda word: (word, 1)).reduceByKey(lambda a, b: a+b)
for wc in wordCounts.collect(): print wc
我得到一个这样的错误列表:
我是否必须修改任何路径或遵循其他配置才能使其工作?
【问题讨论】:
标签: python windows eclipse apache-spark