Python 3.x WindowsError:[Error2]系统找不到指定的文件

Python 3.x WindowsError:[Error2]系统找不到指定的文件,python-3.x,subprocess,Python 3.x,Subprocess,我希望程序在一段时间后打开指定的链接,然后关闭浏览器。重复此任务3次。 但我最终得到了提到的错误 import time import subprocess total_breaks = 3 break_count = 0 print("This program started on " + time.ctime()) while(break_count < total_breaks): browser = subprocess.Popen(['firefox', 'https:/

我希望程序在一段时间后打开指定的链接,然后关闭浏览器。重复此任务3次。 但我最终得到了提到的错误

import time
import subprocess
total_breaks = 3
break_count = 0
print("This program started on " + time.ctime())
while(break_count < total_breaks):
    browser = subprocess.Popen(['firefox', 'https://www.google.com/'])
    sleep(10)
    browser.terminate()
    break_count = break_count + 1
导入时间
导入子流程
总断裂=3
中断计数=0
打印(“此程序开始于”+time.ctime())
而(中断次数<总中断次数):
browser=subprocess.Popen(['firefox','https://www.google.com/'])
睡眠(10)
browser.terminate()
中断计数=中断计数+1

您需要指定firefox的路径,如错误所示:

WindowsError:[Error2]系统找不到指定的文件


嗨,维维克,没必要在这里大喊大叫(
#
);每个人都在被听到/读/看到:)
subprocess.Popen([r'C:\Program Files\Mozilla Firefox\Firefox.exe',
'-new-tab', 'http://www.google.com/'])