python - 在 Windows 上使用 Github Actions 进行 Python 测试
问题描述
我正在尝试使用 GitHub 操作在 Windows 上测试 Python 包。以下工作描述在 Linux 和 MacOS 上是成功的,但在 Windows 上最后Test ${{ matrix.os }} binding
一部分失败了。
test:
strategy:
matrix:
os: [windows-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v1
- uses: actions-rs/toolchain@v1
with:
toolchain: nightly
default: true
- name: Unit tests
run: cargo test
- uses: actions/setup-python@v1
with:
python-version: '3.7'
- name: Test ${{ matrix.os }} binding
run: |
python3 -m venv venv3
venv3\Scripts\Activate.ps1
python3 -m pip install maturin numpy
maturin develop
python3 -m unittest discover tests
这是生成的错误日志。
2020-05-02T11:26:46.8753138Z ##[group]Run actions/setup-python@v1
2020-05-02T11:26:46.8753394Z with:
2020-05-02T11:26:46.8753556Z python-version: 3.7
2020-05-02T11:26:46.8753701Z architecture: x64
2020-05-02T11:26:46.8753843Z ##[endgroup]
2020-05-02T11:26:46.9972224Z Successfully setup CPython (3.7.6)
2020-05-02T11:26:47.0429209Z ##[group]Run python3 -m venv venv3
2020-05-02T11:26:47.0429485Z python3 -m venv venv3
2020-05-02T11:26:47.0429617Z venv3\Scripts\Activate.ps1
2020-05-02T11:26:47.0429746Z python3 -m pip install maturin numpy
2020-05-02T11:26:47.0429871Z maturin develop
2020-05-02T11:26:47.0430000Z python3 -m unittest discover tests
2020-05-02T11:26:47.0470479Z shell: C:\Program Files\PowerShell\7\pwsh.EXE -command ". '{0}'"
2020-05-02T11:26:47.0470607Z env:
2020-05-02T11:26:47.0470733Z pythonLocation: C:\hostedtoolcache\windows\Python\3.7.6\x64
2020-05-02T11:26:47.0470858Z ##[endgroup]
2020-05-02T11:26:57.7836092Z ##[error]Process completed with exit code 1.
2020-05-02T11:26:57.7855441Z Cleaning up orphan processes
我不清楚它为什么会失败。
解决方案
Python 3 可执行文件通常python3
在 Linux 和 Mac 上可用,默认情况下python
可能是旧的 Python 2。在 Windows 上不是这种情况,所以解决方案就是使用python
.
推荐阅读
- excel - 在电源查询中从文件夹中获取数据时从 .xls 文件中导入数据
- java - Eclipse 在代码完成时抛出异常
- ios - 以编程方式在 UIVisualEffectView 中使用 UITabBarController
- c++ - 如何使用 C++ 更改/设置 DNS?
- python - pytorch hook function is not executed
- node.js - 启动 REACT 前端时 npm 找不到 index.html
- java - Android 11 中的 HTTP 连接错误:cleartextTrafficPermitted="true" 不起作用
- postgresql - 从 Kubernetes jumpbox 运行 Postgres CLI 客户端
- django - Django JWT 身份验证在浏览器中不起作用?
- java - 有没有办法通过 USB 在 Java 中传输数据