繁体   English   中英

在 travis-ci 中为 C 和 Python 的项目使用`generic` 图像时指定 python 版本

[英]Specifying python version when using `generic` image in travis-ci for a project with both C and Python

我有一个同时使用 C(和 GSL 库)和 Python 的项目。 我希望在安装 GSL 库后在 Python 中运行测试。 Travis-CI 允许包含gcc编译器和 Python 的generic图像,所以这听起来非常适合这个项目。 我似乎无法指定用于pippython调用的 Python 版本。 以下.travis.yml构建失败,日志显示 pytest 使用的是 Python 2.7。 我试过python3 -m pytest也试过使用pip3但都没有奏效。 如何指定 python (3.6.2) 的版本,以便在generic映像下为此版本的 python 运行 pip install 模块和 pytest?

非常感谢您的帮助。

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

如果你有python3pip3这意味着pytest适用于python 2,pythonpip

安装python3-pytest然后为脚本指定pytest-3而不是pytest ,可能也使用pip3而不是pip进行安装

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM