简体   繁体   English

(Python)“ cmd中的自动输入”

[英](Python) “auto input in cmd”

i'm trying to make an auto compiler for a file using pyinstaller. 我正在尝试使用pyinstaller为文件创建自动编译器。 here is the auto compiler code: 这是自动编译器代码:

import os
os.system('pyinstaller Main.py')
os.remove('Main.spec')

but then the cmd asks: "The output directory: " C:\\ Users... " and all it's contents will be removed! Continue? y/n " then the user must press y to delete the unwanted file. 但是cmd会询问:“输出目录:“ C:\\ Users ...”,所有内容将被删除!继续吗?y / n“然后用户必须按y删除不需要的文件。 is there any way to "auto input " the key Y and continue deleting unwanted files? 有什么办法“自动输入”键Y并继续删除不需要的文件? (The pyinstaller creates the "mainfile".specs, build folder ( unwanted) and dist folder ( program compiled into it)) srry for bad english (pyinstaller创建“ mainfile” .specs,build文件夹(不需要)和dist文件夹(已编译到其中的程序))

It appears pyinstaller has an option -y or --noconfirm to avoid such an interactive question. 似乎pyinstaller具有-y--noconfirm选项,以避免出现此类交互式问题。 Have you tried that? 你有尝试过吗?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM