0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

github actionsでpython version 3.10 を指定したつもりが3.1と認識されてエラーになる

Last updated at Posted at 2022-12-29

github actionsでpython version 3.10 を指定したつもりが3.1と認識されてエラーになる

例えば、以下のようにgithub actions用の.yamlファイルにpython-versionを記載するとエラーになる

.github/workflow/test.yaml
...
    runs-on: ubuntu-latest
    strategy:
      matrix:
        python-version: [3.9, 3.10]
...

以下のissueによると、python-version指定時は'3.9'などシングルクオートでかこう必要があるらしい。
3.10は数字扱いでパースされ3.1と解釈されてしまうらしい。

https://github.com/actions/setup-python/issues/160

   Please pay attention that task input follow semver notation.

   As for the confusing error message, it is a feature of YAML parsing. When you specify input like

   version: 3.10
   3.10 is parsed as a number and it is trimmed to 3.1 that looks like expected behavior for numbers.
   You should specify input with quotes to treat it as string.

   version: '3.10'

以下のように'3.9','3.10'などシングルクオートでかこうことで解決

.github/workflow/test.yaml
...
    runs-on: ubuntu-latest
    strategy:
      matrix:
        python-version: ['3.9', '3.10']
...

参考

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?