【发布时间】:2018-03-20 07:11:17
【问题描述】:
自从从 numpy 1.13.3 更新到 1.14.2 后,我在 scipy 中遇到了一个异常
scipy.optimize.minimize 调用
scipy.optimize.minimize(minimization_function, weigths,
method="SLSQP",
args=(...),
constraints=OPTIMIZER_CONSTRAINTS,
bounds=(bounds))
导致引发异常:
TypeError: numpy boolean subtract, the `-` operator, is deprecated,
use the bitwise_xor, the `^` operator, or the logical_xor function instead.
这是使用 Docker 的容器化服务的一部分 用于安装预编译的二进制文件。
RUN sudo apt-get install python3-scipy python3-pandas python3-numpy
安装 scipy 或 pandas pull numpy 1.14.2
有没有办法使用 apt-get 安装 1.13.3?
【问题讨论】:
-
是的,但是代码重构将是正确的下一步。
-
你试过设置 virtualenvs 吗?您可以使用较旧的 numpy 版本进行设置,而不会弄乱全局安装..
-
@user3666197 这不是我的具体代码的问题。 scipy 正在使用布尔减法,不推荐使用的
-运算符不能编码。 -
@rammelmueller 这是我看到的唯一解决方案,因为我不知道用 apt-get 指定版本的方法
标签: numpy scipy failed-installation