当我try 在没有互联网连接的情况下运行tox时,它会打印以下错误消息:

py3 inst-nodeps: mypackage/.tox/.tmp/package/1/mypackage-0.1.1.dev0.tar.gz
ERROR: invocation failed (exit code 1), logfile: mypackage/.tox/py3/log/py3-12.log
=================================================================================== log start ===================================================================================
Processing ./.tox/.tmp/package/1/mypackage-0.1.1.dev0.tar.gz
  Installing build dependencies: started
  Installing build dependencies: finished with status 'error'
  error: subprocess-exited-with-error
  
  × pip subprocess to install build dependencies did not run successfully.
  │ exit code: 1
  ╰─> [7 lines of output]
      WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.HTTPSConnection object at 0x7fbb577c1dc0>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution')': /simple/flit-core/
      WARNING: Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.HTTPSConnection object at 0x7fbb577c1e50>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution')': /simple/flit-core/
      WARNING: Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.HTTPSConnection object at 0x7fbb577c1b20>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution')': /simple/flit-core/
      WARNING: Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.HTTPSConnection object at 0x7fbb577c1760>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution')': /simple/flit-core/
      WARNING: Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.HTTPSConnection object at 0x7fbb5783fc10>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution')': /simple/flit-core/
      ERROR: Could not find a version that satisfies the requirement flit_core<4,>=3.2 (from versions: none)
      ERROR: No matching distribution found for flit_core<4,>=3.2
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error

× pip subprocess to install build dependencies did not run successfully.
│ exit code: 1
╰─> See above for output.

note: This error originates from a subprocess, and is likely not a problem with pip.

==================================================================================== log end ====================================================================================
____________________________________________________________________________________ summary ____________________________________________________________________________________
ERROR:   py3: InvocationError for command mypackage/.tox/py3/bin/python -m pip install --no-deps -U .tox/.tmp/package/1/mypackage-0.1.1.dev0.tar.gz (exited with code 1)

我的毒物.ini看起来像这样:

[tox]
envlist = py3
isolated_build = True

[testenv]
deps =
    mypy
    pytest
    types-appdirs
commands =
    mypy src/mypackage tests
    pytest

通过互联网连接运行tox的效果与预期一致.

我已经try 了this issue中给出的建议,在我的tox中添加以下几行.但是似乎没有任何效果,没有互联网连接我无法运行tox.

setenv = VIRTUALENV_DOWNLOAD=0
         PIP_DISABLE_PIP_VERSION_CHECK=1

我正在使用tox 3.25.0和pip 20.3.4,我在两个不同的项目中try 了这一点,一个使用flit 3.7.1,另一个使用setuptools.

有人知道我如何在没有互联网连接的情况下运行tox吗?

推荐答案

你需要pre-download dependencies并离线安装它们.在tox中.ini使用install_command.类似于

[testenv]
install_command=python -m pip install {opts} --no-index --find-links /path/to/download/dir/ {packages}

Python相关问答推荐

在输入行运行时停止代码

Pandas:计算中间时间条目的总时间增量

Python类型提示:对于一个可以迭代的变量,我应该使用什么?

如何编辑此代码,使其从多个EXCEL文件的特定工作表中提取数据以显示在单独的文件中

Pandas数据框上的滚动平均值,其中平均值的中心基于另一数据框的时间

Python:从目录内的文件导入目录

Django抛出重复的键值违反唯一约束错误

递归链表反转与打印语句挂起

如何在表单中添加管理员风格的输入(PDF)

如何在Python中实现高效地支持字典和堆操作的缓存?

两个名称相同但值不同的 Select 都会产生相同的值(discord.py)

更新包含整数范围的列表中的第一个元素

Pandas:新列,从列表中采样,基于列值

将COLUMN BY GROUP中的值连接为列表,并将其赋值给PANAS数据框中的变量

检测并显示网页更改

如何根据预定义的模板重新排序YAML键并维护注释?

PANDA TO_DICT-按键列出行(_D)

C++和NumPy之间的Python绑定中复杂的C++生命周期问题

压平JSON后的Pandas 保留柱

有没有办法一次删除字典里的几个条目?