微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

VS Code 在 conda 环境中无法识别包

如何解决VS Code 在 conda 环境中无法识别包

我正在尝试在我的 conda 环境中运行以下 AWS notebooks

一个单元格是:

import boto3
import sagemaker
from sagemaker import get_execution_role

ecr_namespace = "sagemaker-training-containers/"
prefix = "script-mode-container"

ecr_repository_name = ecr_namespace + prefix
role = get_execution_role()
account_id = role.split(":")[4]
region = boto3.Session().region_name
sagemaker_session = sagemaker.session.Session()
bucket = sagemaker_session.default_bucket()

print(account_id)
print(region)
print(role)
print(bucket)

当我尝试运行它时出现此错误 - ModuleNotFoundError: No module named 'boto3'

我已经在我的环境中通过 pip 安装了 boto3、sagemaker 和所有相关的依赖项,并通过 $conda list 确认。

我还检查了我的解释器正在运行的环境,它似乎是具有所需依赖项的正确环境 - Current: ~/anaconda3/envs/local_SageMaker/bin/python

我在 Windows 上运行良好,所以我很困惑为什么这在我的 linux 端不起作用。

有没有人有关于如何让 VS Code 解释器识别我的 conda 环境中的包的解决方案?

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。