usr/bin/python3^M: bad interpreter: No such file or directory

Posted joeshang

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了usr/bin/python3^M: bad interpreter: No such file or directory相关的知识,希望对你有一定的参考价值。

执行.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保存退出

以上是关于usr/bin/python3^M: bad interpreter: No such file or directory的主要内容,如果未能解决你的问题,请参考以下文章

Python 操作Redis

python爬虫入门----- 阿里巴巴供应商爬虫

Python词典设置默认值小技巧

《python学习手册(第4版)》pdf

Django settings.py 的media路径设置

Python中的赋值,浅拷贝和深拷贝的区别