您的位置:首页 > 移动开发

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

2016-05-12 10:53 573 查看
在单机测试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保存退出
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: