Sagemaker Python SDK 安装问题

0

【以下的问题经过翻译处理】 我尝试跟着教程在我的本地Linux虚拟机中使用AWS Sagemaker的脚本模式,但我甚至不能让基础功能工作。

步骤:

  • ➜ ~> python3 --version

Python 3.6.9

  • ➜ ~> pip3 install sagemaker    

...

Successfully installed boto3-1.14.42 botocore-1.17.42 importlib-metadata-1.7.0 packaging-20.4 protobuf3-to-dict-0.1.5 s3transfer-0.3.3 sagemaker-2.3.0 smdebug-rulesconfig-0.1.4 zipp-3.1.0

➜ ~> cat sagemaker.py

import sagemakerimport boto3

sess = sagemaker.Session()

➜ ~~> python3 sagemaker.py

Traceback (most recent call last):

File "sagemaker.py", line 1, in <module>

import sagemaker

File "~~/sagemaker.py", line 4, in <module>

sess = sagemaker.Session()

AttributeError: module 'sagemaker' has no attribute 'Session'

我也安装了aws cli (version 2) ,并使用具有完全权限的IAM凭据进行配置,所以与此无关。

我的Python SDK安装有问题吗?谢谢。

profile picture
专家
已提问 8 个月前29 查看次数
1 回答
0

【以下的回答经过翻译处理】 你应该给你的脚本起一个与sagemaker.py不同的名称,因为当进行导入操作时,Python会首先在当前目录查找模块,所以导入sagemaker将不会导入Sagemaker SDK,而是导入你的脚本。

profile picture
专家
已回答 8 个月前

您未登录。 登录 发布回答。

一个好的回答可以清楚地解答问题和提供建设性反馈,并能促进提问者的职业发展。

回答问题的准则