pyinstaller -F filename.py 打包后里面的os.system()执行失效
我写好了一个python文件直接运行的话是可以正常跑的
但是用pyinstaller -F filename.py 打包成exe文件之后
别的语句也能正常实现
但是碰到os.system()语句后就跳过了
查了好久也没结果
求解决!!{:10_266:}{:10_266:}{:10_266:} 发你的代码,这边测试一下 zltzlt 发表于 2020-8-2 21:08
发你的代码,这边测试一下
import os
def baise():
url = input("请输入您要下载的视频的网址:")
caption = input("是否下载字幕(y/n):")
path = input("请输入您要保存的位置(如果不输默认为D:\\video_download):")
return url, caption, path
def main():
while 1:
url, caption, path = baise()
if url == '':
print('worry')
continue
else:
if caption == 'n' and path == '':
os.system(r'cmd /k you-get --no-caption -o D:\video_download "%s"' % url)
print('下载成功!\n\n')
elif caption == 'y' and path == '':
os.system(r'cmd /k you-get -o D:\video_download "%s"' % url)
print('下载成功!\n\n')
elif caption == 'n' and path != '':
os.system(r'mcd /k you-get -o %s "%s"' % (path, url))
print('下载成功!\n\n')
elif caption == 'y' and path != '':
os.system(r'cmd /k you-get --no-caption -o %s "%s"' % (path, url))
print('下载成功!\n\n')
if __name__ == '__main__':
main()
多谢大佬 ZhKQYu 发表于 2020-8-2 21:14
多谢大佬
这样试试:
import os
def baise():
url = input("请输入您要下载的视频的网址:")
caption = input("是否下载字幕(y/n):")
path = input("请输入您要保存的位置(如果不输默认为D:\\video_download):")
return url, caption, path
def main():
while 1:
url, caption, path = baise()
if url == '':
print('worry')
continue
else:
if caption == 'n' and path == '':
os.popen(r'cmd /k you-get --no-caption -o D:\video_download "%s"' % url).read()
print('下载成功!\n\n')
elif caption == 'y' and path == '':
os.popen(r'cmd /k you-get -o D:\video_download "%s"' % url).read()
print('下载成功!\n\n')
elif caption == 'n' and path != '':
os.popen(r'mcd /k you-get -o %s "%s"' % (path, url)).read()
print('下载成功!\n\n')
elif caption == 'y' and path != '':
os.popen(r'cmd /k you-get --no-caption -o %s "%s"' % (path, url)).read()
print('下载成功!\n\n')
if __name__ == '__main__':
main() zltzlt 发表于 2020-8-2 21:17
这样试试:
可以了 谢谢啊太感谢了
页:
[1]