pyinstaller生成的exe程序使用使用默认程序打开execel文件
我机器本身已经安装了wps,在pycharm执行情况下,打开一个excel文件是很简单的,使用如下代码:
os.system(excel_path)
但是使用pyinstaller生成的exe程序打开excel文件总是会带上一个烦人的windows命令窗口,同时为了不阻塞主线程, 我使用了另外一个子线程启动了子进程,亲测有效:
threading.Thread( target=subprocess.call, args=(cmd,), kwargs={ 'shell': True, 'stdin': subprocess.PIPE, 'stdout': subprocess.PIPE, 'stderr': subprocess.PIPE } ).start()