admin管理员组

文章数量:1123086

Suppose I have a python venv with package A installed that depended on package B. B is currently version 1.0.0 and over the course of several months or years newer versions comes out, say, B 1.0.1, 1.0.2, ..., 1.1.0, etc.

If I install another package C that also depends on B, then the version of B I currently have installed (1.0.0) is untouched if it meets C's requirements. However, if the very latest version of C depends on >=B 1.1.0, then "pip install C" will also replace B 1.0.0 with whatever is the latest B 1.1.x, and potentially breaking A.

What's considered the best practice for handling this sort of thing?

At the moment I tend to first install new packages to a different location using a different non-privilege user and look out for error messages saying that it's unable to uninstall B 1.0.0, at which point I examine the requirements of all the packages this might impact on (e.g. running pipdeptree to get an overview for the dependencies of other already installed packages), and if necessary, try a slightly older version of package C that still supports B 1.0.x. Then once I'm sure any dependency issues been sorted, I reinstall C into the main package location using the main user account for that.

But this seems a bit laborious, and I'm wondering if there are better way to do this.

本文标签: