Python 如何正确使用Pipenv和Tox?

Python 如何正确使用Pipenv和Tox?,python,virtualenv,pipenv,tox,Python,Virtualenv,Pipenv,Tox,我开始使用pipenv来取代pip freeze>requirements.txt,并对我们的第三方依赖关系进行更高级的控制。我所有的新代码都是用Python 3.8编写的 问题是,当我使用tox根据Python2.7验证代码时,pipenv检查pipfile.lock,它包含Python3.8使用的散列,导致安装失败。如何配置tox从头开始创建新环境,而不使用pipfile锁中的散列 我的文件: [[source]] url = "https://pypi.org/simple&qu

我开始使用pipenv来取代
pip freeze>requirements.txt
,并对我们的第三方依赖关系进行更高级的控制。我所有的新代码都是用Python 3.8编写的

问题是,当我使用
tox
根据Python2.7验证代码时,
pipenv
检查
pipfile.lock
,它包含Python3.8使用的散列,导致安装失败。如何配置
tox
从头开始创建新环境,而不使用pipfile锁中的散列

我的文件:

[[source]]
url = "https://pypi.org/simple"
verify_ssl = true
name = "pypi"

[packages]
jinja2 = "*"
pandas = "*"
python-docx = "*"
docxtpl = "*"
numpy = "*"
af-design-report = {path = ".", editable = true}

[dev-packages]
flake8 = "*"
coverage = "*"
tox = "*"
pytest = "*"
pytest-coverage = "*"
pytest-flake8 = "*"
Sphinx = "*"
tox-pipenv = "*"
我的tox.ini:

[tox]
envlist = py27,py38

[testenv:py27]
allowlist_externals=pipenv
commands =
    pipenv install --dev
    pytest  --cov-report html:cov_html --cov=af_design_report tests

[testenv:py38]
allowlist_externals=pipenv
commands =
    pipenv install --dev
    pytest  --cov-report html:cov_html --cov=af_design_report tests

[testenv:docs]
description = invoke sphinx-build to build the HTML docs
deps = sphinx >= 1.7.5, < 2
commands =  build
[tox]
envlist=py27,py38
[测试版本:py27]
allowlist_externals=pipenv
命令=
pipenv安装--dev
pytest--cov报告html:cov_html--cov=af_设计_报告测试
[测试版本:py38]
allowlist_externals=pipenv
命令=
pipenv安装--dev
pytest--cov报告html:cov_html--cov=af_设计_报告测试
[测试:文档]
description=调用sphinx构建来构建HTML文档
德普斯=斯芬克斯>=1.7.5,<2
命令=构建

这并不能帮助您解决
pipenv
的问题,但如果您没有听说过,还有
pip工具
,它提供了
pip freeze
命令,基本上是一种类固醇
pip freeze
。下面是关于同时支持Python2和Python3锁定文件的讨论。。。