gpt4 book ai didi

python - Travis-ci 自动从requirements.txt 文件安装包

转载 作者:太空宇宙 更新时间:2023-11-03 20:35:19 24 4
gpt4 key购买 nike

我有基于 docker-compose 文件的 Django 应用程序。不知何故,travis 自动安装了项目存储库中的requirements.txt 中的软件包,并且它导致我的构建失败,因为我没有 gcc 软件包。我想在 docker 容器中运行所有操作(测试、linter),而不是直接在项目存储库中运行。

这是我的 travis-ci.yml 文件:

---
dist: xenial
services:
- docker
language: python
python:
- "3.7"
script:
- docker compose up --build
- docker exec web flake8
- docker exec web mypy my_project
- docker exec web safety check -r requirements.txt
- docker exec web python -m pytest --cov my_project -vvv -s

Travis 日志的开头:

$ git checkout -qf bab09dee57a707a5cd0a353d6f50bb66fd90a095
0.01s$ source ~/virtualenv/python3.7/bin/activate
$ python --version
Python 3.7.1
$ pip --version
pip 19.0.3 from /home/travis/virtualenv/python3.7.1/lib/python3.7/site-packages/pip (python 3.7)
$ pip install -r requirements.txt
...
py_GeoIP.c:23:19: fatal error: GeoIP.h: No such file or directory
compilation terminated.
error: command 'gcc' failed with exit status 1
...

你知道为什么 travis 会有这样的行为吗?

最佳答案

根据https://docs.travis-ci.com/user/languages/python/#dependency-management travisci 自动安装requirements.txt 依赖项。要忽略此行为,我必须将以下行添加到 travis.yml 中以覆盖它:安装:pip --version

关于python - Travis-ci 自动从requirements.txt 文件安装包,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57201909/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com