首页 > 解决方案 > 在“windows-latest”vm上使用powershell任务时如何在azure上使用conda?

问题描述

我正在尝试在 Windows vm 上的 azure 管道中使用 conda。在这个问题中,解决方案是eval $(conda shell.bash hook)在 linux 和 macos 上使用对我有用的方法,但由于明显的原因在 windows 上失败了。在 windows vm 下使用 powershell 任务时的等价物是什么?

我试过了

conda shell.powershell hook

call conda shell.powershell hook 

conda init powershell

但所有这些都失败了

No action taken.

CommandNotFoundError: Your shell has not been properly configured to use 'conda activate'.
If using 'conda activate' from a batch script, change your
invocation to 'CALL conda.bat activate'.

To initialize your shell, run

    $ conda init <SHELL_NAME>

Currently supported shells are:
  - bash
  - cmd.exe
  - fish
  - tcsh
  - xonsh
  - zsh
  - powershell

See 'conda init --help' for more information and options.

IMPORTANT: You may need to close and restart your shell after running 'conda init'.

如何让 conda 与 powershell 和 windows vm 一起使用?

我正在使用的 azure yaml 是:

      - powershell: |
          conda shell.powershell hook
          conda activate pyomexmeta
          cd $(INSTALL_DIRECTORY)
          python setup.py bdist_wheel
          $wheel = Get-ChildItem -LiteralPath . -Recurse -File |% FullName
          pip install $wheel
          ipython -c "import pyomexmeta;pyomexmeta.run_tests()"

标签: pythonazurepowershellconda

解决方案


推荐阅读