繁体   English   中英

hadoop /usr/bin/env: python: 没有那个文件或目录

[英]hadoop /usr/bin/env: python: No such file or directory

我正在尝试使用 shell 脚本中的以下命令运行 hadoop 流服务器

hadoop jar /usr/local/hadoop/contrib/streaming/hadoop-0.19.2-streaming.jar -input $1 -output Twitter/Net.pegasus -mapper 'mapper.py Reverse' -reducer NONE -file mapper.py
hadoop jar /usr/local/hadoop/contrib/streaming/hadoop-0.19.2-streaming.jar -input $1 -output Twitter/Net.exclude -mapper 'mapper.py Reverse' -reducer reducer.py -file mapper.py -file reducer.py -file ../twitter/exclude.txt
hadoop jar /usr/local/hadoop/contrib/streaming/hadoop-0.19.2-streaming.jar -input $1 -output Twitter/Net.complete -mapper 'mapper.py Reverse' -reducer reducer.py -file mapper.py -file reducer.py

我收到以下错误

/usr/bin/env: python2.5: No such file or directory
java.lang.RuntimeException: PipeMapRed.waitOutputThreads(): subprocess failed with code 127
    at org.apache.hadoop.streaming.PipeMapRed.waitOutputThreads(PipeMapRed.java:362)
    at org.apache.hadoop.streaming.PipeMapRed.mapRedFinished(PipeMapRed.java:576)
    at org.apache.hadoop.streaming.PipeMapper.close(PipeMapper.java:135)
    at org.apache.hadoop.mapred.MapRunner.run(MapRunner.java:57)
    at org.apache.hadoop.streaming.PipeMapRunner.run(PipeMapRunner.java:36)
    at org.apache.hadoop.mapred.MapTask.runOldMapper(MapTask.java:436)
    at org.apache.hadoop.mapred.MapTask.run(MapTask.java:372)
    at org.apache.hadoop.mapred.Child$4.run(Child.java:255)
    at java.security.AccessController.doPrivileged(Native Method)
    at javax.security.auth.Subject.doAs(Subject.java:415)
    at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1136)
    at org.apache.hadoop.mapred.Child.main(Child.java:249)

但是已经安装了更高版本的python

$ which python
/usr/bin/python
$ python --version
Python 2.7.3

我在其他一些帖子中读到,通过“apt-get install python2.5”它可以工作,但该软件包不可用,我也尝试将 #!/usr/bin/env python 添加到我的 python 脚本的顶部,但它没有工作任何一个

python中的Hadoop Streaming Job失败错误

$ which python
/usr/bin/python
$ python --version
Python 2.7.3

表明您安装的 Python 版本高于默认版本。 您必须确保集群中的每个节点都是相同的情况。 例如,我使用集群 Redhat 6.4 版本集群,默认 Python 是 Python 2.6 我认为是默认的,但是我对主节点进行了一些自定义,它与 datanode 不同。 所以你需要配置你的映射器来调用一个存在于每个节点上的 python。

#!/usr/bin/python

在 python 脚本的开头总是对我有用。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM