我有一個使用需要構建的庫的python項目。鑑於我使用了蟒蛇。我想爲travis創建一個計劃,讓我測試多個python版本,但我無法做到這一點。以下是我有:帶有anaconda和travis的多個python版本
- 我想測試它針對多個版本的Python(如2.7,3.5,3.6)
- 我有
requirements.yml
文件,它看起來像以下:
channels: - kne dependencies: - numpy - pytest - numpy - scipy - matplotlib - seaborn - pybox2d - pip: - gym - codecov - pytest - pytest-cov
我.travis.yml
包含:
language: python
# sudo false implies containerized builds
sudo: false
python:
- 3.5
- 3.4
before_install:
# Here we download miniconda and install the dependencies
- export MINICONDA=$HOME/miniconda
- export PATH="$MINICONDA/bin:$PATH"
- hash -r
- wget http://repo.continuum.io/miniconda/Miniconda-latest-Linux-x86_64.sh -O miniconda.sh
- bash miniconda.sh -b -f -p $MINICONDA
- conda config --set always_yes yes
- conda update conda
- conda info -a
- echo "Python version var"
- echo $TRAVIS_PYTHON_VERSION
- conda env create -n testenv -f environment.yml python=$TRAVIS_PYTHON_VERSION
- source activate testenv
install:
- python setup.py install
script:
- python --version
- python -m pytest --cov=.
- codecov
如果我把Python版本放入environment.yml
它工作正常,但我不能使用多個python版本。對我而言,如果提供-f
,它似乎會忽略列出的任何其他軟件包conda env create
。
此外,env創建後添加- conda install -n testenv python=$TRAVIS_PYTHON_VERSION
不起作用。
UnsatisfiableError: The following specifications were found to be in conflict:
- functools32 -> python 2.7.*
- python 3.5*
Use "conda info <package>" to see the dependencies for each package.
我該怎麼辦,爲了讓它工作?
//如果你想看到更多的細節,它可以在這裏找到:https://travis-ci.org/mbednarski/Chiron/jobs/220644726