在同一环境中使用conda和pip install是一个坏主意吗? [英] Is that a bad idea to use conda and pip install on the same environment?

查看:1178
本文介绍了在同一环境中使用conda和pip install是一个坏主意吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我很好奇.

由于conda安装和pip安装在许多情况下本质上是相同的,因此最佳选择是什么?是否存在只应遵守pip install的情况?对称,是否存在只应坚持使用conda安装的情况?通过在单个环境中同时使用conda和pip安装,有没有办法一脚射出?

Since conda install and pip install in many cases doing essentially the same thing, what would be the best option? Is there a case when someone should stick to pip install only? Symmetrical, is there a case when one should stick to conda install only? Is there a way to shoot in once's foot by using both conda and pip install in a single environment?

更新:如果两种方法本质上是相同的,并且彼此不矛盾,则没有理由只坚持其中一种而不是另一种.

An update: if both approaches are essentially the same and don't contradict each other there should be no reason to stick solely to one of them but not to the other.

推荐答案

请勿在conda环境中混合conda installpip install.大概一次决定全部使用condavirtualenv+pip.这就是您如何确定最适合您的一种方法:

Don't mix conda install and pip install within conda environment. Probably, decide to use conda or virtualenv+piponce and for all. And here is how you decide which one suits you best:

  • Conda在conda环境中安装了各种(不仅是python)采用conda的软件包.如果您喜欢环境,它可以使您的环境正确.
  • Pip在python环境中安装python软件包(virtualenv是其中之一).它会正确安装您的python软件包.

使用conda的安全方法:不要急于使用最新的东西,并坚持使用可用的软件包,就可以了.

Safe way to use conda: don't rush for the latest stuff and stick to the available packages and you'll be fine.

使用pip + virtualenv的安全方法::如果您遇到依赖关系问题,或希望在打包后删除并清理-请勿.只需烧毁房屋,放弃旧环境并创建一个新环境即可.一个命令行和2-5分钟后,一切都会变得井井有条.

Safe way to use pip+virtualenv: if you see a dependency issue or wish to remove and clean up after package - don't. Just burn the house, abandon your old environment and create a new one. One command line and 2-5 minutes later things gonna be nice and tidy again.

Pip是安装这两个软件包中最好的工具.由于pip包通常先出现,然后才被conda(由conda员工或贡献者)采用.可能是,在更新或安装了最新版本的python之后,某些软件包只能通过pip获得.而最新的最新版本的软件包只能以pip的形式获得.将pip和conda软件包混合在一起可能是一场噩梦 (至少如果您想利用conda的优势).

Pip is the best tool installing python packages among the two of them. Since pip packages normally come out first and only later are adopted for conda (by conda staff or contributors). Chances are, after updating or installing latest version of python some of the packages would only be available through pip. And latest freshest versions of packages would only be available in pip. And mixing pip and conda packages together can be a nightmare (at least if you want to utilize conda advantages).

Conda是最好的.卸载软件包时,conda可以自行正确清理,并且可以更好地控制冲突的依赖版本.另外,conda可以导出环境配置,如果当前行星正确,并且新机器相差不大,则可以将该环境复制到其他位置.另外,conda可以对环境进行更大的控制,例如可以在其中安装不同版本的python(virtualenv-仅系统中可用的python).您随时可以创建一个conda程序包当您没有选择使用什么内容的自由时.

Conda is the best when it comes to managing dependencies and replicating environments. When uninstalling package conda can properly clean up after itself and has better control over conflicting dependency versions. Also, conda can export environment config and, if the planets are right at the moment and new machine is not too different, replicate that environment somewhere else. Also, conda can has larger control over the environment and can, for example, have a different version of python installed inside of it (virtualenv - only the python available in the system). You can always create a conda package when you have no freedom of choosing what to use.

一些相关事实:

  • Conda需要更多的空间和时间来设置
  • 如果您没有系统管理员权限,Conda可能会更好
  • 当您没有系统python时,Conda将提供帮助
  • virtualenv + pip将使您摆脱对类似细节的了解

一些过时的概念:

  • 在过去(2012ish),Conda过去对于新手开发人员来说是更好的选择.不再存在可用性差距
  • Conda与Continuum Analytics的链接过多.现在Conda本身是开源的,软件包-不多.

这篇关于在同一环境中使用conda和pip install是一个坏主意吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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