单机测试python编写的mapper时出现/usr/bin/python3^M: bad interpreter: No such file or directory

来源:互联网 发布:淘宝网卖二手货在哪里 编辑:程序博客网 时间:2024/05/16 09:29

在单机测试python编写的mapper时出现

hadoop@ub1401:~/hadoop/hadoopfile$ cat keywords-blank-1.txt|./PictureDownloadMapper.py
bash: ./PictureDownloadMapper.py: /usr/bin/python3^M: bad interpreter: No such file or directory

经查有可能是

1、执行权限的问题

2、python版本的问题

3、python文件格式的错误。

权限问题利用chmod +x ***py即可

版本问题,在执行时或者在py文件中选择好python的版本

格式问题参考博文,解决过程如下:

hadoop@ub1401:~/hadoop/hadoopfile$ vi PictureDownloadMapper.py

在vi编辑器下:

:set ff 或 :set fileformat

可以查看到当前的格式(fileformat=dos 或 fileformat=unix

修改格式为unix

:set ff=unix或者 :set fileformat=unix

:wq保存退出



0 0
原创粉丝点击