如何使用environtment.yml文件将pip本地库安装到conda环境中? [英] How to install local library with pip to a conda environment using environtment.yml file?

查看:607
本文介绍了如何使用environtment.yml文件将pip本地库安装到conda环境中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I want to set up an environment.myl file for a project's conda environment. I have a local package that I would normally use pip install -e . so I can work on the code locally. Is there a way to use pip to install this package with the env file?

我根据在github链接中使用安装选项找到的内容尝试了此操作,但是不起作用.

I tried this based on something I found using install options with github links, but doesn't work.

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

推荐答案

据我从阅读需求文件格式 ,即

As far as I can tell from reading 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, namely,

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

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

I did a quick test on a local package and I was able to verify that the package installed and shows up in pip list -e.

还有一个advanced-pip/回购中的示例,其中说明了一些其他选项.

There is also an advanced-pip/ example in the repo that illustrates some additional options.

这篇关于如何使用environtment.yml文件将pip本地库安装到conda环境中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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