我想在 Travis CI 构建环境中运行一个简单的 Python 3 脚本。我按照 Travis CI Python 指南 ( https://docs.travis-ci.com/user/languages/python ) 创建了一个初始.travis.yml文件。
Travis CI 在单独的 virtualenv 中针对 YML 文件中描述的 Python 版本运行每个构建。
我的脚本依赖于requests模块,我将其添加到requirements.txt文件中,然后 pip 将其安装在 Travis CI 中,但是一旦脚本运行,脚本就无法导入模块。
错误
./benchmark.py https://graph.irail.be/sncb/connections -n 10 -i -o results.csv
Traceback (most recent call last):
File "./benchmark.py", line 3, in <module>
import requests
ImportError: No module named 'requests'
.travis.yml
language: python
python:
- "3.3"
- "3.4"
- "3.5"
- "3.6"
# command to install deps
install:
- pip install -r requirements.txt
# run build
script:
- ./benchmark.py https://graph.irail.be/sncb/connections -n 10 -i -o results.csv
我的 Github 仓库:https : //github.com/DylanVanAssche/http-benchmark/tree/feature/CI
我的 Travis CI 构建:https : //travis-ci.com/DylanVanAssche/http-benchmark/jobs/145320050
MMTTMM
相关分类