2
可能重複:
ubuntu /usr/bin/env: python: No such file or directory爲什麼執行python腳本時會出現No such file or directory error?
我的hadoop streaming的新學員。我遇到了一個學習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)
當我執行以下命令:
[email protected]:/home/test$ echo "I love China I love ieee I love python" | /home/test/mapper.py
我得到的結果是:
: No such file or directory
不過,我敢肯定,該文件確實存在於該路徑中,可以通過ls
看到。所以我只是想知道我該如何解決這個問題。
確實[這個答案](http://stackoverflow.com/questions/3655306/ubuntu-usr-bin-env-python-no-such-file-or-di教區)解決你的問題? –