linux – shebang行无法正常工作
发布时间:2020-05-27 13:19:13 所属栏目:Linux 来源:互联网
导读:不知道我的shebang线有什么问题: vic@ubuntu:~/Desktop$./test.py : No such file or directoryvic@ubuntu:~/Desktop$ls -l...-rwxr-xr-x 1 vic vic 35 2011-11-06 15:46 test.py...vic@ubuntu:~/Desktop$cat t
|
不知道我的shebang线有什么问题: vic@ubuntu:~/Desktop$./test.py
: No such file or directory
vic@ubuntu:~/Desktop$ls -l
...
-rwxr-xr-x 1 vic vic 35 2011-11-06 15:46 test.py
...
vic@ubuntu:~/Desktop$cat test.py
#!/usr/bin/env python
print('!')
vic@ubuntu:~/Desktop$/usr/bin/env python
Python 2.7.2+ (default,Oct 4 2011,20:06:09)
[GCC 4.6.1] on linux2
Type "help","copyright","credits" or "license" for more information.
>>>
有任何想法吗? vic@ubuntu:~/Desktop$head -n 2 test.py|hexdump -C 00000000 23 21 2f 75 73 72 2f 62 69 6e 2f 65 6e 76 20 70 |#!/usr/bin/env p| 00000010 79 74 68 6f 6e 0d 0a 0d 0a |ython....| 00000019 vic@ubuntu:~/Desktop$ 解决方法您的文件具有Windows类型的行结尾.将它转换为正确的Unix类型的行尾,你应该好好去.$dos2unix test.py (编辑:安卓应用网) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
相关内容
- Grep排除文件夹并使用linux进行搜索
- Another app is currently holding the yum lock
- linux – send()什么时候会返回小于length的参数?
- 在rsync中处理重命名的文件或目录
- ssh – PermitRootLogin不行,我无法登录,但为什么要求用户输
- 如何通过桌面上的远程服务器上的ssh启动带有命令的屏幕会话
- linux – Bash / Shell – 将所有文件从子目录移动到目标目
- osx – 将KVM(用于Linux)移植到Mac OS X
- 为什么要多次通过构建Linux From Scratch(LFS)?
- linux – 从命令行切换GNOME终端配置文件
