Django提供了AttributeError-'_thread._local'对象没有属性'state'

时间:2020-07-22 10:08:57

标签: python-3.x django sympy attributeerror thread-local

我正在创建一个django应用程序,该应用程序需要使用sympy python软件包进行数学计算。

为了给您一个涉及的计算类型的例子,让我们考虑一下三个方程-

  1. x + y = 100
  2. y = 200
  3. z + x = 300

我使用sympy包的solve()方法计算x,y和z的所有可能值。但是,这给出了AttributeError-'_thread._local'对象没有属性'state'

下面是完整的追溯-

Items    Length  Width   Height  Netweight
LPN1        2       2       2       60
LPN2        3       3       3       40
LPN3        3       3       3       100

我尝试了以下技巧,但都给出了相同的错误-

  1. 重新安装sympy软件包
  2. 使用python manage.py --runserver --nothreading
  3. 使用python manage.py --runserver --nothreading --noreload

任何有关如何解决此错误的建议/反馈将不胜感激。请在这里帮助我!

1 个答案:

答案 0 :(得分:0)

这是sympy 1.6.1中的一个错误,尽管该补丁尚未发布,但已修复: https://github.com/sympy/sympy/issues/19809

您可以使用sympy 1.6.0或git中的最新sympy母版,也可以手动应用此修复程序。