Home > other >  Numba using an error
Numba using an error

Time:09-18

Numba has been installed in the system, but I do the following code times wrong, don't know what the reason, ask for help!
Code:
#! The/usr/bin/env python
# coding: utf-8

The from numba import jit

@ jit (nopython=True)
Def f (x, y) :
# A somewhat trivial example
Return x + y

If __name__=="__main__" :
Print f (1, 2)


Results:
Traceback (the most recent call last) :
The File "./testv6. Py ", line 4, the in & lt; module>
The from numba import jit
The File "/home/STZ/local/lib/python2.7/site - packages/numba/set py", line 196, in & lt; module>
The import numba. Typed
The File "/home/STZ/local/lib/python2.7/site - packages/numba/typed/set py", line 3, the in & lt; module>
From the typeddict import Dict
The File "/home/STZ/local/lib/python2.7/site - packages/numba/typed/typeddict py", line 19, in & lt; module>
@ njit
The File "/home/STZ/local/lib/python2.7/site - packages/numba/decorators. Py", line 238, in njit
Return the jit (* args, * * KWS)
The File "/home/STZ/local/lib/python2.7/site - packages/numba/decorators. Py", line 175, in a jit
Return wrapper (pyfunc)
The File "/home/STZ/local/lib/python2.7/site - packages/numba/decorators. Py", line 191, wrapper in
* * dispatcher_args)
The File "/home/STZ/local/lib/python2.7/site - packages/numba/dispatcher. Py", line 650, in __init__
Self. Targetctx=self. Targetdescr. Target_context
The File "/home/STZ/local/lib/python2.7/site - packages/numba/the targets/registry. Py", line, 50 in target_context
Return the self. _toplevel_target_context
The File "/home/STZ/local/lib/python2.7/site - packages/numba/utils. Py", line 390, in __get__
Res=instance. __dict__ [self. The name]=self. The func (instance)
The File "/home/STZ/local/lib/python2.7/site - packages/numba/the targets/registry. Py", 34, the line in _toplevel_target_context
Return the CPU. CPUContext (self. Typing_context)
The File "/home/STZ/local/lib/python2.7/site - packages/numba/the targets/base. Py", line 260, in __init__
The self. The init ()
The File "/home/STZ/local/lib/python2.7/site - packages/numba/compiler_lock. Py", line 32, in _acquire_compile_lock
Return func (* args, * * kwargs)
The File "/home/STZ/local/lib/python2.7/site - packages/numba/the targets/CPU. Py", line 61, in the init
Rtsys. The initialize (self)
The File "/home/STZ/local/lib/python2.7/site - packages/numba/compiler_lock. Py", line 32, in _acquire_compile_lock
Return func (* args, * * kwargs)
The File "/home/STZ/local/lib/python2.7/site - packages/numba/runtime/NRT. Py", 39, the line in the initialize
Self. _library=nrtdynmod.com pile_nrt_functions (CTX)
The File "/home/STZ/local/lib/python2.7/site - packages/numba/runtime/nrtdynmod py", line 210, in compile_nrt_functions
Library. Add_ir_module (ir_mod)
The File "/home/STZ/local/lib/python2.7/site - packages/numba/the targets/codegen py", line 200, in add_ir_module
Ir=cgutils. Normalize_ir_text (STR) (ir_module)
The File "/home/STZ/local/lib/python2.7/site - packages/llvmlite/ir/module. Py", line 244, in __repr__
Lines +=self. _get_metadata_lines ()
The File "/home/STZ/local/lib/python2.7/site - packages/llvmlite/ir/module. Py", line 222, in _get_metadata_lines
Mdbuf. Append (STR) (md)
The File "/home/STZ/local/lib/python2.7/site - packages/llvmlite/ir/_utils. Py", 48, the line in the __str__
S=self. __cached_str=self. _to_string ()
The File "/home/STZ/local/lib/python2.7/site -/packages/llvmlite/ir values. Py", line 223, in _to_string
Self. Descr (buf)
The File "/home/STZ/local/lib/python2.7/site -/packages/llvmlite/ir values. Py", line 354, in descr
Operands. Append (op) get_reference ())
The File "/home/STZ/local/lib/python2.7/site - packages/llvmlite/ir/_utils. Py", 58, line in get_reference
S=self. __cached_refstr=self. _get_reference ()
The File "/home/STZ/local/lib/python2.7/site -/packages/llvmlite/ir values. Py", line 277, in _get_reference
Return '!" {0} '. "the format (_escape_string (self. String))
The File "/home/STZ/local/lib/python2.7/site -/packages/llvmlite/ir values. Py", line 36, in _escape_string
Buf=[_map [ch] for ch in text]
KeyError: 'b'

  • Related