Traceback (most recent call last): File "D:\Learning\coding\python\数学建模\2021C\蒙特卡洛模拟.py", line 70, in <module> prob.solve(solver='GLPK_MI') File "D:\Learning\coding\python\python\lib\site-packages\cvxpy\problems\problem.py", line 473, in solve return solve_func(self, *args, **kwargs) File "D:\Learning\coding\python\python\lib\site-packages\cvxpy\problems\problem.py", line 971, in _solve solver, gp, enforce_dpp, verbose) File "D:\Learning\coding\python\python\lib\site-packages\cvxpy\problems\problem.py", line 582, in get_problem_data solver=solver, gp=gp, enforce_dpp=enforce_dpp) File "D:\Learning\coding\python\python\lib\site-packages\cvxpy\problems\problem.py", line 811, in _construct_chain candidate_solvers = self._find_candidate_solvers(solver=solver, gp=gp) File "D:\Learning\coding\python\python\lib\site-packages\cvxpy\problems\problem.py", line 690, in _find_candidate_solvers raise error.SolverError("The solver %s is not installed." % solver) cvxpy.error.SolverError: The solver GLPK_MI is not installed.
时间: 2023-07-31 07:07:47 浏览: 201
Python程序基础:Python中的异常.pptx
5星 · 资源好评率100%
The error message indicates that the solver GLPK_MI is not installed in your environment. GLPK_MI is a solver used by CVXPY, a convex optimization library in Python. To resolve this issue, you can try installing the GLPK_MI solver.
If you have pip installed, you can try running the following command in your terminal or command prompt:
```
pip install cvxpy[glpk]
```
This command will install CVXPY with GLPK_MI solver support. After installing, you should be able to run your code without encountering the "SolverError" related to GLPK_MI.
阅读全文