numba jit:' DataFlowAnalysis'对象没有属性' op_STORE_DEREF'

时间:2016-10-16 11:49:34

标签: python jit numba

我尝试使用numba运行以下代码但收到错误:

from numba import jit

@jit(nopython=True)
def create_card_deck():
    values = "23456789TJQKA"
    suites = "CDHS"
    Deck = []
    [Deck.append(x + y) for x in values for y in suites]
    return Deck

create_card_deck()

感谢任何导致此错误的建议:

'DataFlowAnalysis' object has no attribute 'op_STORE_DEREF'

1 个答案:

答案 0 :(得分:5)

这里有两个问题 - 更基本的问题是numbanopython模式下不支持字符串

@jit(nopython=True)
def create_card_deck():
    values = "23456789TJQKA"
    suites = "CDHS"
    return values

In [4]: create_card_deck()
---------------------------------------------------------------------------
NotImplementedError : Failed at nopython (nopython mode backend)
cannot convert native str to Python object

该特定错误是因为在nopython模式下目前也不支持列表推导。

https://github.com/numba/numba/issues/504