舍邦线不工作
不知道我的 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$
Don't know what's wrong with my shebang line:
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.
>>>
Any ideas?
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$
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您的文件具有 Windows 类型的行结尾。将其转换为正确的 Unix 类型行结尾,然后就可以开始了。
Your file has Windows-type line endings. Convert it to proper Unix-type line endings and you should be good to go.