如何使用 environtment.yml 文件将带有 pip 的本地库安装到 conda 环境中?

How to install local library with pip to a conda environment using environtment.yml file?

我想为项目的 conda 环境设置一个 environment.myl 文件。我有一个我通常会使用 pip install -e . 的本地包,所以我可以在本地处理代码。有没有办法使用 pip 通过 env 文件安装这个包?

我根据使用带有 github 链接的安装选项发现的东西尝试了此方法,但没有用。

name: foo
channels:
  - defaults
dependencies:
  - python=3.7
  - pip
  - pip:
    - /Users/me/projects/package/ --install-option="-e"

据我所知 the code, conda-env will copy the entries in the pip dictionary and place them into a temporary pip requirements file. Hence, you should follow the Requirements File Format,即

name: foo
channels:
  - defaults
dependencies:
  - python=3.7
  - pip
  - pip:
    - -e /Users/me/projects/package

我对本地包进行了快速测试,我能够验证该包是否已安装并显示在 pip list -e

还有 an advanced-pip/ example in the repo 说明了一些额外的选项。