【问题标题】:Bitbucket pipleline python3.7 not found! Try the pythonBin option找不到Bitbucket管道python3.7!尝试 pythonBin 选项
【发布时间】:2021-03-08 08:49:50
【问题描述】:

我有下面的 bitbucket 管道

    image: node:11.13.0-alpine

pipelines:
  branches:
    master:
      - step:
          caches:
            - node
          script:
            - apk add python py-pip python3
            - npm install -g serverless
            - serverless config credentials --stage dev --provider aws --key $AWS_ACCESS_KEY_ID --secret $AWS_SECRET_ACCESS_KEY
            - cd src/rsc_user
            - pip install -r requirements.txt
            - sls plugin install -n serverless-python-requirements
            - sls plugin install -n serverless-wsgi
            - npm i serverless-package-external --save-dev
            - npm install serverless-domain-manager --save-dev
            - serverless deploy --stage dev
      

投掷错误

 Error --------------------------------------------------
Error: python3.7 not found! Try the pythonBin option.
  at pipAcceptsSystem (/opt/atlassian/pipelines/agent/build/src/rsc_user/node_modules/serverless-python-requirements/lib/pip.js:100:13)
  at installRequirements (/opt/atlassian/pipelines/agent/build/src/rsc_user/node_modules/serverless-python-requirements/lib/pip.js:173:9)
  at installRequirementsIfNeeded (/opt/atlassian/pipelines/agent/build/src/rsc_user/node_modules/serverless-python-requirements/lib/pip.js:556:3)
  at ServerlessPythonRequirements.installAllRequirements (/opt/atlassian/pipelines/agent/build/src/rsc_user/node_modules/serverless-python-requirements/lib/pip.js:635:29)
  at ServerlessPythonRequirements.tryCatcher (/opt/atlassian/pipelines/agent/build/src/rsc_user/node_modules/bluebird/js/release/util.js:16:23)
  at Promise._settlePromiseFromHandler (/opt/atlassian/pipelines/agent/build/src/rsc_user/node_modules/bluebird/js/release/promise.js:547:31)
  at Promise._settlePromise (/opt/atlassian/pipelines/agent/build/src/rsc_user/node_modules/bluebird/js/release/promise.js:604:18)
  at Promise._settlePromise0 (/opt/atlassian/pipelines/agent/build/src/rsc_user/node_modules/bluebird/js/release/promise.js:649:10)
  at Promise._settlePromises (/opt/atlassian/pipelines/agent/build/src/rsc_user/node_modules/bluebird/js/release/promise.js:729:18)
  at _drainQueueStep (/opt/atlassian/pipelines/agent/build/src/rsc_user/node_modules/bluebird/js/release/async.js:93:12)
  at _drainQueue (/opt/atlassian/pipelines/agent/build/src/rsc_user/node_modules/bluebird/js/release/async.js:86:9)
  at Async._drainQueues (/opt/atlassian/pipelines/agent/build/src/rsc_user/node_modules/bluebird/js/release/async.js:102:5)
  at Immediate.Async.drainQueues [as _onImmediate] (/opt/atlassian/pipelines/agent/build/src/rsc_user/node_modules/bluebird/js/release/async.js:15:14)
  at processImmediate (internal/timers.js:443:21)
  at process.topLevelDomainCallback (domain.js:136:23)

 For debugging logs, run again after setting the "SLS_DEBUG=*" environment variable.
Get Support --------------------------------------------
 Docs:          docs.serverless.com
 Bugs:          github.com/serverless/serverless/issues
 Issues:        forum.serverless.com
Your Environment Information ---------------------------
 Operating System:          linux
 Node Version:              11.13.0
 Framework Version:         2.1.1
 Plugin Version:            4.0.4
 SDK Version:               2.3.2
 Components Version:        3.1.4

由于我是 python 新手,所以我无法收到此错误。 任何帮助都非常感谢

谢谢

【问题讨论】:

    标签: python aws-lambda serverless-framework bitbucket-pipelines


    【解决方案1】:

    这个错误基本上意味着你没有正确安装python。某些应用程序需要 python3.7 而您没有使用apk add python3 指定版本。因此,可能已安装最新版本 (3.8)。

    这个article 处理如何为bitbucket 管道中的代理选择给定的python 版本。基本上可以归结为:

    image: python:3.7
    pipelines:
      default:
        - step:
            script:
              - python --version
    

    您是否有理由必须使用 Alpine?否则我会选择上面的务实形象。

    【讨论】:

    • 我刚开始在 python 中工作,我不知道这与我本地机器上安装的 python 有什么关系。这是在 bitbucket 管道中运行的
    • 当我添加 apk add python3.7 时,它显示“错误:无法满足的约束:python3.7(缺失):”
    • 因此您的 bitbucket 管道在代理上运行您的管道。如果该代理没有安装正确的工具,您将看到类似这样的错误。为了清楚起见,我会修改我的答案。
    • 如果你想要一个 alpine/python 组合,它们总是可用的。请参阅docker public registry
    • 抱歉愚蠢的问题......我应该用“node:11.13.0-alpine:3.11”替换节点:11.13.0-alpine,实际上我第一次这样做非常困惑或“ python:11.13.0-alpine:3.11"
    【解决方案2】:

    他解决了

    pythonRequirements:
       pythonBin: python3
    

    Similar problem

    【讨论】:

      猜你喜欢
      • 2020-01-04
      • 2020-07-22
      • 1970-01-01
      • 2023-03-29
      • 1970-01-01
      • 2019-07-07
      • 2019-03-03
      • 2022-11-02
      • 2020-08-25
      相关资源
      最近更新 更多