CVXPY——最新版问题

问题

  CVXPY可以成功安装上,运行代码时提示:

RuntimeError: module compiled against API version 0xe but this version of numpy is 0xd

  问题在于最新版CVXPY需要numpy1.20及以上版本,但是系统上安装的numpy低于1.20。

解决方案

查看当前numpy版本

  可以通过下面代码查询numpy的版本:

pip show numpy

运行结果如下图:
在这里插入图片描述

numpy升级

pip install -U numpy

顺便说下numpy怎么降级(下面这个不用运行)

pip install -U numpy==1.12.0

后面的1.12.0是需要降级的版本号

之后重新安装CVXPY即可。

猜你喜欢

转载自blog.csdn.net/qq_16775293/article/details/117932394