Import ModuleNotFoundError:运行sagemaker管道步骤时没有名为X的模块

2024-04-28 21:55:31 发布

您现在位置:Python中文网/ 问答频道 /正文

我使用CodeBuild来构建和运行管道(sagemaker处理步骤)。我在codebuild-buildspec.yml文件中编写了所有安装命令,但似乎在运行每个步骤时,都会创建一个新的环境,因为无法导入任何指定的包(ModuleNotFoundError:没有名为X的模块)

我的buildspec.yml文件有以下几行:

  install:
    runtime-versions:
      python: 3.8
    commands:
      - pip install --upgrade --force-reinstall . awscli
      - pip install  --force-reinstall pyyaml
      - pip install  --force-reinstall --no-deps sagemaker
      - pip install --upgrade --force-reinstall boto3
  
  build:
    commands: ...

从main pipeline.py文件导入时,它可以工作,但在每个步骤上调用其他脚本时,它就无法工作

我错过了什么

谢谢


Tags: installpip文件命令管道yml步骤upgrade