python隐藏终端执行cmd命令的方法
2019-06-24 08:43
2983 查看
在用pyinstaller打包后不想要后面的终端命令框,但是打包时加了-w或者--noconsole命令后会导致cmd程序不能运行从而出错。这个时候用subprocess可以解决该类问题。
import subprocess cmd = 'your command' res = subprocess.call(cmd, shell=True, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
这样打包后出来的程序就不会出现命令框,而且也能够正常运行了。
以上这篇python隐藏终端执行cmd命令的方法就是小编分享给大家的全部内容了,希望能给大家一个参考
您可能感兴趣的文章:
相关文章推荐
- Python执行系统命令并获得输出的几种方法
- Python执行系统命令的方法 os.system(),os.popen(),commands
- python执行系统命令的几种方法
- Python执行系统命令的方法 os.system(),os.popen(),commands
- Python执行系统命令的方法 os.system(),os.popen(),commands
- Python执行Linux系统命令的4种方法
- Python执行系统命令的方法 os.system(),os.popen(),commands
- Python执行系统命令的方法 os.system(),os.popen(),commands
- Python执行系统命令的方法 os.system(),os.popen(),commands
- Python中执行系统命令常见方法有两种:
- Python执行Linux系统命令的4种方法
- Python执行cmd的各种实现方法及优劣(subprocess.Popen, os.system和commands.getstatusoutput)
- Python执行系统命令的方法 os.system(),os.popen(),commands
- Python执行系统命令的方法
- 终端中执行命令时提示权限不够的解决方法
- Python中执行系统命令常见的几种方法
- SQL下三种执行CMD命令的方法
- Python执行系统命令的方法
- 终端直接执行py文件,不需要python命令
- Python执行系统命令的方法 os.system(),os.popen(),commands