简体   繁体   English

多个版本的 conda 和 pip 封装

[英]Multiple versions of conda and pip packages

Python, problem with different versions of packages. Python,不同版本的包有问题。 It often happens that package developers specify obsolete versions of packages in their dependencies. package 开发人员经常会在其依赖项中指定过时版本的包。

Is there a relatively simple (without editing the source code of the packages) way to specify that a particular package will have the old version of the dependency that it needs only, and not so that it is installed for the entire project.是否有一种相对简单(无需编辑包的源代码)的方法来指定特定的 package 将具有它只需要的旧版本的依赖项,而不是为整个项目安装它。 For conda and pip.对于 conda 和 pip。

Now you have to either have several versions of the kernels, and restart all the necessary code in jupiterlab, or abandon some of the packages.现在您必须拥有多个版本的内核,并在 jupiterlab 中重新启动所有必要的代码,或者放弃一些包。

Example.例子。 I have a skearn.我有一个searn。

import sklearn
sklearn.__version__
'1.1.1'

I want to install the auto-sklearn library.我想安装 auto-sklearn 库。 But in https://github.com/automl/auto-sklearn/blob/development/requirements.txt :但是在https://github.com/automl/auto-sklearn/blob/development/requirements.txt中:

scikit-learn>=0.24.0,<0.25.0

This version is obsolete, and the dependency is explicitly specified, version 1.1.1 will be overwritten by 0.25.0.此版本已过时,并且明确指定了依赖项,版本 1.1.1 将被 0.25.0 覆盖。 I want auto-sklearn to have its old sklearn dependency.我希望 auto-sklearn 具有其旧的 sklearn 依赖项。

No, there is not a way to have one package reference one version of a dependency while all other packages use a different version.不,没有办法让一个 package 引用一个版本的依赖项,而所有其他包使用不同的版本。

Rather, use a separate environment to isolate different sets of packages that work together for different tasks.相反,使用单独的环境来隔离为不同任务一起工作的不同包集。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM