我想在 Travis CI 構(gòu)建環(huán)境中運(yùn)行一個(gè)簡(jiǎn)單的 Python 3 腳本。我按照 Travis CI Python 指南 ( https://docs.travis-ci.com/user/languages/python ) 創(chuàng)建了一個(gè)初始.travis.yml文件。Travis CI 在單獨(dú)的 virtualenv 中針對(duì) YML 文件中描述的 Python 版本運(yùn)行每個(gè)構(gòu)建。我的腳本依賴于requests模塊,我將其添加到requirements.txt文件中,然后 pip 將其安裝在 Travis CI 中,但是一旦腳本運(yùn)行,腳本就無(wú)法導(dǎo)入模塊。錯(cuò)誤./benchmark.py https://graph.irail.be/sncb/connections -n 10 -i -o results.csvTraceback (most recent call last):File "./benchmark.py", line 3, in <module> import requestsImportError: No module named 'requests'.travis.ymllanguage: pythonpython: - "3.3" - "3.4" - "3.5" - "3.6"# command to install depsinstall: - pip install -r requirements.txt# run buildscript: - ./benchmark.py https://graph.irail.be/sncb/connections -n 10 -i -o results.csv我的 Github 倉(cāng)庫(kù):https : //github.com/DylanVanAssche/http-benchmark/tree/feature/CI我的 Travis CI 構(gòu)建:https : //travis-ci.com/DylanVanAssche/http-benchmark/jobs/145320050
Travis CI Python 無(wú)法導(dǎo)入“請(qǐng)求”
三國(guó)紛爭(zhēng)
2021-06-14 13:08:16