添加链接
link管理
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接
Collectives™ on Stack Overflow

Find centralized, trusted content and collaborate around the technologies you use most.

Learn more about Collectives

Teams

Q&A for work

Connect and share knowledge within a single location that is structured and easy to search.

Learn more about Teams pytest --doctest-modules

It works well. But when I replace "py3" with "py37", it fails with the error:

ERROR:  py37: InterpreterNotFound: python3.7

As far as I know, tox should support Python 3.7. Is this a problem specifically with tox on github?

Is Python 3.7 installed on the machine? Is it accessible, for example as python3.7 on the command line? – sinoroc Jul 30, 2020 at 20:23 @sinoroc The project is on GitHub, and tox is run by "GitHub actions", so it is not my machine. How can I check if python3.7 is installed on their machine? – Erel Segal-Halevi Jul 30, 2020 at 20:29 I see, it wasn't clear from the question. I'm not familiar with Github actions. But I guess a good first step would be to show the github actions configuration (the workflows?), so that users familiar with it can help sort it out. – sinoroc Jul 30, 2020 at 21:42 You can check here for software installed on the runners docs.github.com/en/actions/reference/…. Using github.com/actions/setup-python will probably fix your problem. – riQQ Aug 1, 2020 at 10:00

In the tox.ini file, write python3.7 instead of py37 and you will see that it works.

All credits to the Github user glinskyc for his thread on Github issues.

Also make sure that you are using the latest version for tox, that is 3.23.1

I just tried this myself. It seemed to work, but then I noticed it runs everything with the default Python (3.9 in my case)! I get messages with paths like /[pathredacted]/.tox/python3.7/lib/python3.9/site-packages/ in them ("python3.7" is the tox environment, and "python3.9" is the Python installed into it). I won't say it never works, but it apparently doesn't work on Linux with tox 3.24.3. – Tim Pederick Aug 31, 2021 at 13:37 July 2022 I still receive the issue pointed out By Tim Pederick, also on Ubuntu 22.04, and now my code is breaking because it is running Python3.10 even though tox says it's running Python3.9 – Justin Furuness Jul 1, 2022 at 5:14 @TimPederick is right, this is just using the most recent available python and not the specified one. You can change it to something crazy like python9000 and it'll still just "work" because that's not a predefined tag like py37 is. – Izkata Jul 20, 2022 at 20:56 Double confirmed: using python3.7 will not fail where it is supposed to fail (on things like forgetting from __future__ import annotations when using type hints), while py37 fails as expected. – uvsmtid Oct 13, 2023 at 18:19

From a combination of the answers and resources provided here. What I did was:

  • through pyenv I did install all python version I needed.
  • I did symlinked all of them in a bin folder which was already in my PATH. Symlinks already were named the same as tox was expecting: python3.7, python3.8 and pypy3
  • no renaming in tox was required
  • Thanks for contributing an answer to Stack Overflow!

    • Please be sure to answer the question. Provide details and share your research!

    But avoid

    • Asking for help, clarification, or responding to other answers.
    • Making statements based on opinion; back them up with references or personal experience.

    To learn more, see our tips on writing great answers.