引入math模块中的log()方法,导致"TypeError: return arrays must be of ArrayType",什么原因?

时间:2023-03-09 09:55:56
引入math模块中的log()方法,导致"TypeError: return arrays must be of ArrayType",什么原因?

from math import log

from numpy import *
import operator

............

re = log(pro,2)

............

TypeError: return arrays must be of ArrayType

把“from math import log”放在最后

from numpy import *
import operator
from math import log

............

re = log(pro,2)

............

程序顺利通过

什么原因呢?希望以后能够解决