|
方法一:把cygwin的bin配置到环境变量里,这样做了以后在cmd.exe里也可以使用linux的命令
def exe_command(command):
p = subprocess.Popen(
command,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
shell='Linux'.__eq__(platform.system())
)
return p.communicate()
方法二:在运行的时候指定sh.exe位置
print subprocess.Popen(
args=["D:/Git/bin/sh.exe", "-c", "grep 'xiaol' E:/test/name.txt"],
shell=True,
stdout=subprocess.PIPE
).stdout.read() |
|
所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298
本贴地址:https://www.yunweiku.com/thread-408219-1-1.html
上篇帖子:
linux学习(七)环境变量、cp、mv、cat,less,more,head,tail
下篇帖子:
Linux学习(四)单用户模式、救援模式、虚拟机克隆、linux互连(包括密匙登录)
|