我在Windows上安装了Baron求解器,并且在Spyder中使用pyomo。我将baron.exe移到当前目录。 我的调用是这样的:
from pyomo.opt import SolverFactory
...
opt = SolverFactory('baron')
opt.solve(instance,keepfiles=True,tee=True)
运行代码时,出现此错误:
Solver log file: 'C:\Users\~\AppData\Local\Temp\tmpumg5hxvr.baron.log'
Solver solution file: 'C:\Users\~\AppData\Local\Temp\tmpbmx1pfpt.baron.soln'
Solver problem files: ('C:\\Users\\~\\AppData\\Local\\Temp\\tmpygo80gcy.pyomo.bar',)
C:\Users\~\baron.exe: can't open C:\Users\~\AppData\Local\Temp\tmpygo80gcy.pyomo.bar.nl
ERROR: Solver (baron) returned non-zero return code (1)
ERROR: See the solver log above for diagnostic information.
Traceback
ApplicationError: Solver (baron) did not exit normally
但是没有日志文件:C:\Users\~\AppData\Local\Temp\tmpumg5hxvr.baron.log
我该如何解决这个问题?
谢谢您的帮助。
答案 0 :(得分:0)
试试:
from selenium import webdriver
from selenium.webdriver.firefox.options import Options
url = 'https://www.google.com'
options = Options()
options.headless = True
try:
driver = webdriver.Firefox(options=options)
driver.get(url)
print(driver.title)
except:
print('Error!')