托克斯可以找到python版本

发布于 2025-02-08 17:43:32 字数 1594 浏览 2 评论 0原文

我有一个tox.ini需要以可编辑模式安装软件包。但是,该软件包没有setup.py - 意味着为了安装它,一个新的pip版本(我认为21.4是足够的,但是要确保,我执行> = 22)

要在本地运行,我刚刚运行:

  1. python3 -m virtualenv venv
  2. 。 VENV/bin/activate&& PIP安装PIP> = 22
  3. 。 VENV/bin/activate&& pip install -e< pkg -path>

我的tox.ini看起来像:

[tox]
envlist = py3
requires =
    tox-pipenv >= 1.10
; Older pip can't install in editable mode without setup.py
    pip >= 22.0.0

[testenv]
; Install "pkg" in editable mode
deps =
    -e <pkg-path>
commands =
    ...

这抛出以下内容:

int(version_dict["major"]) if version_dict.get("major") is not None else major
ValueError: invalid literal for int() with base 10: '.tox/bin/python'

================================================================================ log end ================================================================================
ERROR: InvocationError for command .../.tox/.tox/bin/python -m pipenv --python .tox/bin/python (exited with code 1)
________________________________________________________________________________ summary ________________________________________________________________________________
ERROR:   py3: InvocationError for command .../.tox/.tox/bin/python -m pipenv --python .tox/bin/python (exited with code 1)

这意味着,这是由于某种原因,我没有有效的python。 ..

我怀疑

    tox-pipenv >= 1.10
    pip >= 22.0.0

台词,但我不能做对了

I have a tox.ini that needs to install a package in editable mode. However, the package has no setup.py - meaning that in order to install it, a new pip version (I think 21.4 is enough, but just to be sure, I enforce >=22)

To run this locally, I just run:

  1. python3 -m virtualenv venv
  2. . venv/bin/activate && pip install pip>=22
  3. . venv/bin/activate && pip install -e <pkg-path>

My tox.ini looks like:

[tox]
envlist = py3
requires =
    tox-pipenv >= 1.10
; Older pip can't install in editable mode without setup.py
    pip >= 22.0.0

[testenv]
; Install "pkg" in editable mode
deps =
    -e <pkg-path>
commands =
    ...

This throws the following:

int(version_dict["major"]) if version_dict.get("major") is not None else major
ValueError: invalid literal for int() with base 10: '.tox/bin/python'

================================================================================ log end ================================================================================
ERROR: InvocationError for command .../.tox/.tox/bin/python -m pipenv --python .tox/bin/python (exited with code 1)
________________________________________________________________________________ summary ________________________________________________________________________________
ERROR:   py3: InvocationError for command .../.tox/.tox/bin/python -m pipenv --python .tox/bin/python (exited with code 1)

which means, that for some reason, I don't have a valid python...

I suspect the

    tox-pipenv >= 1.10
    pip >= 22.0.0

lines, but I can't make it right

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

倾`听者〃 2025-02-15 17:43:32

这是一个解决方法 - 但它有效。

我发现(手动检查了几个版本后)virtualenv == 20.10带有一个足够的新pip,所以我尝试使用它...

    tox-pipenv >= 1.10
    pip >= 22.0.0

用另一个依赖关系 替换了- virtualenv

requires =
; Older pip can't install in editable mode without setup.py. I couldn't enforce
; pip version directly, but enforcing virtualenv is good enough, becuase it has
; it's own pip inside, and this version has a new enough pip version
    virtualenv >= 20.10

出于某种原因 - 这起作用!


这里有一个奇怪的问题:以下行(每当我构建旧的tox.ini时,我都会看到它:

.tox installDeps:...

​这可能仅由于我的默认virtualenv现在更新...

edit:false警报::)实际上是正确的解决方案...我没有看到该解决方案行是因为tox跳过了它,因为它已经满足了要求。现在我降级virtualenv,该行回来了:)

This is a workaround - but it works.

I found out (after checking several versions manually) that virtualenv==20.10 comes with a new enough pip, so I tried using that...

I replaced the

    tox-pipenv >= 1.10
    pip >= 22.0.0

with another dependency - virtualenv:

requires =
; Older pip can't install in editable mode without setup.py. I couldn't enforce
; pip version directly, but enforcing virtualenv is good enough, becuase it has
; it's own pip inside, and this version has a new enough pip version
    virtualenv >= 20.10

and for some reason - this works!


There is a weird issue here: the following line (which I used to see whenever I built the old tox.ini) is missing:

.tox installdeps: ...

Not sure what it means, but I think that probably something is wrong on my setup. It is possible that this works only because my default virtualenv is now updated...

EDIT: False alarm :) It is actually the correct solution... The reason I didn't see that line was because tox skipped it because it already has satisfied the requirements. Now I downgraded virtualenv and the line is back :)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文