我使用conda,并试图弄清楚如何使circleci运行。我在一个名为calculator
的环境中有一个非常简单的项目,它具有两个功能(一个addition
,一个subtraction
和每个功能一个测试)。我正在使用pylint8
检查格式,并使用pytest
/ pytest-cov
进行测试/覆盖。
我的配置文件如下,在进入测试运行阶段之前,它似乎一直有效:
# Python CircleCI 2.0 configuration file
version: 2
jobs:
build:
docker:
- image: continuumio/miniconda3
working_directory: ~/repo
steps:
# Step 1: obtain repo from GitHub
- checkout
# Step 2: create virtual env and install dependencies
- run:
name: install dependencies
command: |
conda env create -f environment.yml
# Step 3: run linter and tests
- run:
name: run tests
command: |
conda init bash
conda activate calculator
flake8 --statistics
pytest -v --cov
第1步和第2步工作正常,但第3步失败并显示以下消息:
#!/bin/bash -eo pipefail
conda init bash
conda activate calculator
flake8 --statistics
pytest -v --cov
no change /opt/conda/condabin/conda
no change /opt/conda/bin/conda
no change /opt/conda/bin/conda-env
no change /opt/conda/bin/activate
no change /opt/conda/bin/deactivate
no change /opt/conda/etc/profile.d/conda.sh
no change /opt/conda/etc/fish/conf.d/conda.fish
no change /opt/conda/shell/condabin/Conda.psm1
no change /opt/conda/shell/condabin/conda-hook.ps1
no change /opt/conda/lib/python3.7/site-packages/xontrib/conda.xsh
no change /opt/conda/etc/profile.d/conda.csh
modified /root/.bashrc
==> For changes to take effect, close and re-open your current shell. <==
CommandNotFoundError: Your shell has not been properly configured to use 'conda activate'.
To initialize your shell, run
$ conda init <SHELL_NAME>
Currently supported shells are:
- bash
- fish
- tcsh
- xonsh
- zsh
- powershell
我使用的是Ubuntu18。以前我没有运行conda init bash
,但是基于错误,我将其放在其中,但是即使我已经这样做了,它仍然建议我初始化外壳程序。 / p>
答案 0 :(得分:1)
conda init bash
更改了.bashrc
,然后必须重新加载。
您可以按此顺序尝试
conda init bash
source ~/.bashrc
conda activate calculator
或简单地尝试使用source activate calculator
的老式方式(根本不运行conda init bash
)。