我开始学习BigQueryML,并试图完成this tutorial。我遇到的问题是,当我尝试添加这行代码时(在步骤一第15部分中找到):
dataset_id = "bqml_tutorial_{}".format(str(uuid.uuid4().hex))
我得到了错误
NameErrorTraceback (most recent call last)
<ipython-input-9-1746232870d0> in <module>()
3 # other invocations of this tutorial. In practice, you could leverage
4 # a persistent dataset and not create/destroy it with each invocation.
----> 5 dataset_id = "bqml_tutorial_{}".format(str(uuid.uuid4().hex))
NameError: name 'uuid' is not defined
我试过使用from uuid import UUID
,但运气不好
谢谢你的帮助
您专门导入了
UUID
,这是一个可以实例化的特定类,但不是uuid4函数:https://docs.python.org/3/library/uuid.html#uuid.UUID如果要使用^{} ,必须实际导入它,因为它与
UUID
类是分开的:这个问题本可以通过查看官方文档来避免。在进行故障排除时,这始终是一个很好的起点
相关问题 更多 >
编程相关推荐