gpt4 book ai didi

python - 当使用echo的代码完美工作时,Hadoop python作业给我一个错误

转载 作者:行者123 更新时间:2023-12-02 21:22:32 24 4
gpt4 key购买 nike

我正在寻找斯坦福大学CS246 2014硬件解决方案中最受欢迎的解决方案。

我一直遇到错误“错误:java.lang.RuntimeException:PipeMapRed.waitOutputThreads():子进程失败,代码为1”

我的映射器的python代码是

{#!/usr/bin/python

import sys

ID = None
fcount = 0
count = 0

for line in sys.stdin:
line = line.strip()

words = line.split(" ")
ID,friends = words
fcount = len(friends.split(","))
#count = fcount * -1
#for i in friends:
# if i != ','

# fcount +=1

print "%d\t%s" %(fcount,ID)

}

我的 reducer 代码是

{
#!/usr/bin/python

import sys

ID = None
fcount = 0
count = 0

for line in sys.stdin:
line = line.strip()

words = line.split(" ")
ID,friends = words
fcount = len(friends.split(","))
#count = fcount * -1
#for i in friends:
# if i != ','

# fcount +=1

print "%d\t%s" %(fcount,ID)

}

任何帮助,将不胜感激

最佳答案

终于明白了。发生错误是由于python的两个不同版本。我的系统上安装了python 3,hadoop系统上安装了python 2。

关于python - 当使用echo的代码完美工作时,Hadoop python作业给我一个错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36904581/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com