【问题标题】:Azure: Installing Python feed packages to PipelineAzure:将 Python 提要包安装到管道
【发布时间】:2022-07-21 16:18:56
【问题描述】:

我有一个 Azure Artifacts 提要,其中包含一个名为 py-data(这是别名)的 Python 包。这可以从提要安装在我的本地计算机上,但是,我正在尝试将其安装为构建管道的依赖项。

我的 YAML 代码如下所示:

pool:
  vmImage: windows-latest
strategy:
  matrix:
    Python39:
      python.version: '3.9'

steps:
- task: UsePythonVersion@0
  inputs:
    versionSpec: '$(python.version)'
  displayName: 'Use Python $(python.version)'

- task: PipAuthenticate@1
  displayName: 'Pip Authenticate'
  inputs:
    artifactFeeds: 'foo-packages'
    onlyAddExtraIndex: true

- script: |
    python -m pip install --upgrade pip
    pip install py-data
    pip install -r requirements.txt
  displayName: 'Install dependencies'

- script: |
    pip install pytest pytest-azurepipelines
    pytest
  displayName: 'pytest'

这不起作用,我收到以下错误:

ERROR: Could not find a version that satisfies the requirement py-data (from versions: none)

PipAuthenticate 提供的 URL 的样式为 https://build:***@bdouk.pkgs.visualstudio.com/,这与人工制品选项卡中连接到提要提供的样式不同。

【问题讨论】:

    标签: python azure-devops


    【解决方案1】:

    我正在为同样的问题头疼。为我解决的问题是在工件提要名称之前添加项目名称,如下所示:

    - task: PipAuthenticate@1
      displayName: 'Pip Authenticate'
      inputs:
         artifactFeeds: 'YOUR-PROJECT/foo-packages'
         onlyAddExtraIndex: true
    

    这很有效,尽管文档表明当提要与管道在同一个项目中时不需要这样做。

    执行此操作后,生成的 URL 与我从“工件”选项卡中的“连接到提要”获得的 URL 相同,只是在前面添加了凭据。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-03-24
      • 1970-01-01
      相关资源
      最近更新 更多