简体   繁体   English

运行命令“conda env create -f environment.yml”后出现警告

[英]Warning after I run the command “conda env create -f environment.yml”

After I run the conda env create -f environment.yml in Conda, I receive the following warning:在 Conda 中运行conda env create -f environment.yml后,我收到以下警告:

Warning: you have pip-installed dependencies in your environment file, but you do not list pip itself as one of your conda dependencies...警告:您的环境文件中有 pip 安装的依赖项,但您没有将 pip 本身列为您的 conda 依赖项之一...

What does this mean and what should I be doing instead?这是什么意思,我应该怎么做?

In your environment yml file under list of the packages you install through conda you must also add pip as a package to be installed.在您通过 conda 安装的软件包列表下的环境 yml 文件中,您还必须添加 pip 作为要安装的 package。 This installs the pip, and so you pip packages can be installed using this pip.这将安装 pip,因此您可以使用此 pip 安装 pip 包。

Previously pip was shipped with conda but now we have to explicitly install pip when using conda以前 pip 与 conda 一起提供,但现在我们必须在使用 conda 时显式安装 pip

When creating an environment the warning disappeared by including - pip explicitly in the yaml file.创建环境时,警告通过在 yaml 文件中显式包含- pip而消失。 Yes, it is a bit awkward because if your environment has pip packages you already have declared that you used pip packages with - pip:是的,这有点尴尬,因为如果你的环境有 pip 包,你已经声明你使用了 pip 包- pip:
The yaml file would look like: yaml 文件如下所示:

# Packages omitted for simplicity
name: myenv
channels:
  - anaconda
  - conda-forge
  - defaults
dependencies:
  - python
  - scipy
  - pip
  - pip:
    - datetime

At the time of creating a new environment from scratch this warming can be avoided by explicitly installing pip, for instance with: conda create -n env_with_pip python=3.7 numpy pip在从头开始创建新环境时,可以通过显式安装 pip 来避免这种升温,例如: conda create -n env_with_pip python=3.7 numpy pip

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

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