我正在尝试在我的本地笔记本电脑上从https://github.com/aws-samples/aws-deepracer-workshops/blob/master/log-analysis/DeepRacer%20Log%20Analysis.ipynb运行 Deepracer 日志分析工具。但是,在尝试运行步骤 [5]“创建 IAM 角色”时出现以下错误。
try:
sagemaker_role = sagemaker.get_execution_role()
except:
sagemaker_role = get_execution_role('sagemaker')
print("Using Sagemaker IAM role arn: \n{}".format(sagemaker_role))
Couldn't call 'get_role' to get Role ARN from role name arn:aws:iam::26********:root to get Role path.
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
<ipython-input-5-3bea8175b8c7> in <module>
1 try:
----> 2 sagemaker_role = sagemaker.get_execution_role()
3 except:
/opt/conda/lib/python3.7/site-packages/sagemaker/session.py in get_execution_role(sagemaker_session)
3302 )
-> 3303 raise ValueError(message.format(arn))
3304
ValueError: The current AWS identity is not a role: arn:aws:iam::26********:root, therefore it cannot be used as a SageMaker execution role
During handling of the above exception, another exception occurred:
NameError Traceback (most recent call last)
<ipython-input-5-3bea8175b8c7> in <module>
2 sagemaker_role = sagemaker.get_execution_role()
3 except:
----> 4 sagemaker_role = get_execution_role('sagemaker')
5
6 print("Using Sagemaker IAM role arn: \n{}".format(sagemaker_role))
NameError: name 'get_execution_role' is not defined
有谁知道要执行以上代码而没有错误需要做什么?