我有一个使用 Microsoft 的 API ( Pywin32 ) 的简单 Python 脚本。我能够在本地机器上成功运行该项目,但在 Travis 中,它会引发错误 - 100% |████████████████████████████████| 51kB 17.9MB/s Collecting pylint==2.2.2 (from -r requirements.txt (line 15)) Downloading https://files.pythonhosted.org/packages/a5/06/ecef826f319055e6b231716730d7f9047dd7524ffda224b521d989f085b6/pylint-2.2.2-py3-none-any.whl (750kB) 100% |████████████████████████████████| 757kB 18.9MB/s Collecting pywin32==224 (from -r requirements.txt (line 16)) Could not find a version that satisfies the requirement pywin32==224 (from -r requirements.txt (line 16)) (from versions: )No matching distribution found for pywin32==224 (from -r requirements.txt (line 16))The command "pip install -r requirements.txt" failed and exited with 1 during .Your build has been stopped.在我的本地系统中,Python 版本是3.6.6,pip 是18.1. 但是如果你在 Travis 中注意到,pip 版本是10.0.1. 这可能是问题吗?我的 travis.yml 文件包含 -language: pythonpython: - "3.6.6"pip: - "18.1"install: - pip install -r requirements.txtscript: - python main.pyPython 包 pywin32==224 存在并且可以在我的本地机器上下载,所以我猜错误不是来自他们这边。谢谢您的帮助。
1 回答

繁星coding
TA贡献1797条经验 获得超4个赞
pywin32 是 WinAPI 包装器,因此它是仅限 Windows 的软件包,您不能在 Linux 上使用它。
特拉维斯CI Linux上的默认运行,但由于2018的10月出现的可能性是通过添加使用Windowsos: windows中的.travis.yml文件。查看Travis 博客文章。
然而,由于它是“早期访问”功能,它仍然错过了很多东西,包括Python 支持。因此,如果您现在需要 Python - 唯一的方法是手动安装它,即像这里
使用 Python 3.8 更新示例(2020 年 4 月),现在似乎是默认值:
- os: windows
language: sh
python: "3.8"
before_install:
- choco install python3
- export PATH="/c/Python38:/c/Python38/Scripts:$PATH"
- python -m pip install --upgrade pip wheel
添加回答
举报
0/150
提交
取消