什么时候可以使用“ conda安装”,什么时候必须使用“ pip安装”

时间:2019-07-01 15:13:51

标签: python pip conda

我正在尝试使用conda来管理环境。大多数时候,我可以简单地执行0x7fffffffeffc: "" 0x7fffffffeffd: "" 0x7fffffffeffe: "" 0x7fffffffefff: "" 0x7ffffffff000: <error: Cannot access memory at address 0x7ffffffff000> 而不是conda install foo。但是,在某些情况下(很少发生),pip install foo可能会遇到conda install foo错误。这是为什么?

这是一个具体的例子。 PackagesNotFoundError工作正常。但是,它的可选依赖项conda install pygal(用于地图支持)之一将无法直接通过conda安装。

pygal_maps_world

我尝试根据http://www.pygal.org/en/stable/documentation/types/maps/pygal_maps_world.html点安装$ conda install pygal_maps_world Solving environment: failed PackagesNotFoundError: The following packages are not available from current channels: - pygal_maps_world Current channels: - https://repo.anaconda.com/pkgs/main/osx-64 - https://repo.anaconda.com/pkgs/main/noarch - https://repo.anaconda.com/pkgs/free/osx-64 - https://repo.anaconda.com/pkgs/free/noarch - https://repo.anaconda.com/pkgs/r/osx-64 - https://repo.anaconda.com/pkgs/r/noarch - https://repo.anaconda.com/pkgs/pro/osx-64 - https://repo.anaconda.com/pkgs/pro/noarch - https://conda.anaconda.org/conda-forge/osx-64 - https://conda.anaconda.org/conda-forge/noarch To search for alternate channels that may provide the conda package you're looking for, navigate to https://anaconda.org and use the search bar at the top of the page. 。然后导出的ymal文件如下所示:

pygal_maps_world

查看底部的^^^,它添加了一个name: foo_env channels: - defaults - conda-forge dependencies: - ... some other libraries - zlib=1.2.11=h1de35cc_3 - zstd=1.3.7=h5bba6e5_0 - pip: - pygal-maps-world==1.0.2 会话。这是为什么?我们如何确定可以通过conda直接安装哪个库,以及哪个库需要通过- pip

1 个答案:

答案 0 :(得分:0)

Understanding Conda and Pip页中所述,Anaconda,Conda和Pip从不同的存储库安装。

  

Pip安装打包为转轮或源代码发行版的Python软件。
  ...
  Conda是一个跨平台的软件包和环境管理器,可从Anaconda存储库以及Anaconda Cloud安装和管理conda软件包。 Conda软件包是二进制文件。

如果您想事先进行手动验证,可以peruse the repositories

或者,如果您以编程方式安装需求,则可以将conda install包装在try / except块中,然后在PackagesNotFoundError上尝试使用pip install