gpt4 book ai didi

python - 为什么在执行 python 脚本时会出现 No such file or directory 错误?

转载 作者:可可西里 更新时间:2023-11-01 14:59:32 26 4
gpt4 key购买 nike

<分区>

Possible Duplicate:
ubuntu /usr/bin/env: python: No such file or directory

我是 hadoop 流式处理的新手。我在学习 mapreduce 时遇到了一个问题。这是我的 mapper.py 代码:

#!/usr/bin/env python 

import sys

# input comes from STDIN (standard input)
for line in sys.stdin:
# remove leading and trailing whitespace
line = line.strip()
# split the line into words
words = line.split()
# increase counters
for word in words:
# write the results to STDOUT (standard output);
# what we output here will be the input for the
# Reduce step, i.e. the input for reducer.py
#
# tab-delimited; the trivial word count is 1
print '%s\t%s' % (word, 1)

当我执行以下操作时:

hadoop@Chris-ubuntu:/home/test$ echo "I love China I love ieee I love python" | /home/test/mapper.py 

我得到了结果:

: No such file or directory

但是,我确定该文件确实存在于该路径中,可以通过ls 看到。所以我只是想知道如何解决这个问题。

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