我刚开始学习Hadoop。我尝试在它上面运行一个简单的mapreduce作业,但在此之前我尝试在本地检查它。但它的返回错误。请建议任何解决方案。我正在使用Ubuntu 12.04 LTS。
所以代码是用gedit编写的,后面是广告。
import sys
for line in sys.stdin:
line = line.strip()
words = line.split()
for word in words:
print '%s\t%s' %(word,1)
然后我在终端写下面的命令来检查mapper是否正常工作
maitreyee@bharti-desktop:~$ echo "foo faa" | /home/maitreyee/Documents/mapper.py
并且终端返回以下错误:
/home/maitreyee/Documents/mapper.py: line 1: import: command not found
/home/maitreyee/Documents/mapper.py: line 5: syntax error near unexpected token `line'
/home/maitreyee/Documents/mapper.py: line 5: `line = line.strip()'