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 (将#修改为@)