系统:Mac OSX 10.6.5,Python 2.6
我尝试运行下面的python脚本:
from mrjob.job import MRJob
class MRWordCounter(MRJob):
def mapper(self, key, line):
for word in line.split():
yield word, 1
def reducer(self, word, occurrences):
yield word, sum(occurrences)
if __name__ == '__main__':
MRWordCounter.run()
我收到以下错误:
:~ vskarich$ python mrjob_test.py < words
Traceback (most recent call last):
File "mrjob_test.py", line 1, in <module>
from mrjob.job import MRJob
ImportError: No module named mrjob.job
我曾经像这样使用easy_install:
sudo easy_install mrjob
该命令下载了所需的 .egg 文件,我的 python 站点包目录如下所示:
:~ vskarich$ cd /Library/Python/2.6/site-packages
:site-packages vskarich$ ls
PyYAML-3.09-py2.6-macosx-10.6-universal.egg
easy-install.pth
README
mrjob-0.2.0-py2.6.egg
boto-2.0b3-py2.6.egg
simplejson-2.1.2-py2.6-macosx-10.6-universal.egg
我不确定在这里做什么,因为我对 python 有点陌生;任何帮助将非常感激。谢谢!