我有一个同时使用C(和GSL库)和Python的项目。我希望在安装GSL库后在Python中运行测试。 Travis-CI允许generic
图像同时包含gcc
编译器和Python,因此这对于该项目来说是理想的选择。我似乎无法指定用于pip
和python
调用的Python版本。以下.travis.yml
构建失败,并且日志显示pytest正在使用Python 2.7。我试过python3 -m pytest
,也试过使用pip3
,但都没有用。如何指定python(3.6.2)的版本,以便在generic
映像下针对该版本的python运行该版本python和pytest的pip安装模块?
非常感谢您的帮助。
language: generic
dist: xenial
env: PYTHON_VERSION=3.6.2
python: 3.6
before_install:
- sudo apt-get install libgsl-dev
install:
- pip install --user -r tests/requirements.txt
script:
- pytest
如果您有python3和pip3,这意味着pytest适用于python 2,例如python和pip
安装python3-pytest,然后为script指定pytest-3而不是pytest,可能还对pip3而不是pip 安装