我编写了一个小的python脚本,但是bash不会执行它:
#!/usr/bin/python
'''
Created on Dec 19, 2014
'''
import subprocess
if __name__ == '__main__':
p = subprocess.Popen('df -h', stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
out,err = p.communicate()
for o in out.splitlines():
if('rootfs' in o):
print o.split()[3]
当我运行./te.py
时,bash给了我一个错误:
-bash: ./te.py: /usr/bin/python^M: bad interpreter: No such file or directory
有什么问题?
答案 0 :(得分:0)
试试这个:
#!/usr/bin/env python