如何使用pipenv安装/更新软件包而不更新其余软件包

问题描述 投票:-1回答:2

我使用pipenv(版本2018.11.26)来管理项目中的依赖项。有时我想只添加或更新一个包,不要更改其他包的版本。我怎样才能做到这一点?我试过了两个

pipenv update --selective-upgrade requests

pipenv update --keep-outdated requests

但是在锁定期间仍会更新所有软件包的版本。

Pipfile和Pifile.lock:https://gist.github.com/jozo/d8351ed708e84c5ea0f69e82e585e5c6

python dependency-management pipenv
2个回答
3
投票

使用pipenv install/uninstall/update运行--keep-outdated将阻止pipenv更新无关的锁定包。 (奇怪的是,这不是默认的befavior)。

如果您不希望某些软件包自动更新,您应该将它们固定在Pipfile中,例如:

[packages]
django = "==2.2"
djangorestframework = "==3.9.2"

0
投票

如果您真的想这样做,请尝试冻结软件包的版本:

pipenv shell
pip install -U django-rest-framework-condition
pip freeze > requirements.txt
exit
pipenv --rm
mv Pipfile Pipfile.bak
mv Pipfile.lock Pipfile.lock.bak
pipenv shell
pipenv install
© www.soinside.com 2019 - 2024. All rights reserved.