python - numba.core.errors.TypingError:在 uuid.uuid1() 的 nopython 模式管道(步骤:nopython 前端)中失败
问题描述
发生numba.core.errors.TypingError: Failed in nopython mode pipeline (step: nopython frontend),当我使用numba加速python时。
基本信息是
python 3.7.9
numba 0.52.0
代码是
@numba.jit(nopython=True)
def add_uuid(*args) -> str:
random_id = uuid.uuid1()
return '_'.join(args) + '_' + str(random_id)
错误详细信息是
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/multiprocessing/process.py", line 297, in _bootstrap
self.run()
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/multiprocessing/process.py", line 99, in run
self._target(*self._args, **self._kwargs)
File "map_client.py", line 55, in __init__
self._map_id = string_util.add_uuid('map_task', job_name)
File "~/.local/share/virtualenvs/map-aGUXCO1N/lib/python3.7/site-packages/numba/core/dispatcher.py", line 414, in _compile_for_args
error_rewrite(e, 'typing')
File "~/.local/share/virtualenvs/map-aGUXCO1N/lib/python3.7/site-packages/numba/core/dispatcher.py", line 357, in error_rewrite
raise e.with_traceback(None)
numba.core.errors.TypingError: Failed in nopython mode pipeline (step: nopython frontend)
Unknown attribute 'uuid1' of type Module(<module 'uuid' from '/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/uuid.py'>)
解决方案
推荐阅读
- django - 如何解决 Django 中的图像调整大小问题?
- angular - 角度不能用于相同标签的切换动作
- reactjs - 如何在新的获取请求中取消先前的获取请求?
- bash - 了解输出到标准输出和常规文件的区别
- c# - 如何通过组合来自两个集合的数据来创建一个集合?
- kubernetes - Kafka 无法连接到 EKS 上的 zookeeper 合奏
- python - 如何在一个字段中选择多个值?
- c++ - 复制构造函数、赋值运算符 C++
- javascript - 在有js代码输出的php代码中是必须的,例如通过alert变量
- android - 为什么要编写测试广告以及 google admob 需要多长时间才能显示在 android 应用程序上?