通过conda为仅pip软件包安装依赖项 [英] Installing dependencies for a pip-only package through conda

查看:94
本文介绍了通过conda为仅pip软件包安装依赖项的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有时候,我需要在conda环境中安装纯pip软件包.如果我使用 pip install 安装软件包,则该软件包的所有依赖项都将使用pip 安装,即使它们可用于conda .

Sometimes I need to install a pip-only package into a conda environment. If I install the package using pip install, then all the dependencies for that package are installed using pip, even if they are available to conda.

我想通过conda安装尽可能多的软件包,因此目前我使用

I would like to install as many packages as possible through conda, so currently I use a hack to get the list of package dependencies through pip, search for all of them on conda, conda install the ones that are found, and then go through with the pip install.

我是否更愿意通过conda而不是pip安装依赖项?如果是这样,谁能想到一种更优雅的方式来解决此问题?

Am I right to prefer installing dependencies through conda rather than pip? And if so, can anyone think of a more elegant way to solve this problem?

推荐答案

pip和conda是两个单独的程序包管理器.只有在极少数情况下,程序包管理器才能真正一起工作.在实际应用中,conda和pip通常不会.

pip and conda are two separate package managers. Only in very rare cases package managers actually work together. In practical applications conda and pip usually do not.

实际上,通常不可避免地要混合使用conda和pip软件包.正如您所描述的,这通常会导致混乱的软件包管理.

In reality, mixing conda and pip packages is usually unavoidable. This often leads to a messy package management, as you describe.

我认为,解决此问题的最佳方法也是目前唯一可行的方法,就是为要在conda环境中使用的所有(pypi-)软件包和依赖项创建一个conda软件包.

In my opinion, the best and currently only proper way to solve this problem is to create a conda package for all (pypi-)packages and dependencies you want to use in your conda environments.

conda-forge 是一项社区活动,它提供了一种简便的方法来贡献您自己的软件包到conda基础设施.您可能想检查一下您的软件包是否已经可用,如果没有,则可以选择提供.

conda-forge is a community effort that offers an easy way to contribute your own package to the conda infrastructure. You may want to check out if your package is already available, and if not if contributing is an option for you.

这篇关于通过conda为仅pip软件包安装依赖项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆