我正在尝试在 python2.7 中运行一个 .exe 文件。我已经尽我所能地搜索它。这是我试过的一些代码:
subprocess.Popen(r"C:\Programs Files\Internet Explorer\iexplore.exe")
和:
subprocess.Popen(["cmd","/c",r"C:\Programs Files\Internet Explorer\iexplore.exe"])
和:
os.popen(r"C:\Programs Files\Internet Explorer\iexplore.exe")
除了第一个(引发 Windows 错误)之外的所有其他似乎都没有运行 iexplore.exe。
还有其他方法可以运行 .exe 文件吗?
请您参考如下方法:
如果你只想打开网络浏览器,你可以这样做:
import webbrowser
webbrowser.open('www.google.com')
