如何让github上的egg文件通过pip不在当前目录中安装,而在conda env目录中安装? [英] How to have egg files from github install with pip not in current directory but in the conda env directory?

查看:124
本文介绍了如何让github上的egg文件通过pip不在当前目录中安装,而在conda env目录中安装?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我首先使用conda,pip和yml配置文件创建python env:

I am creating a python env using conda, pip and yml config file by using first:

conda env create -f test.yml -n test_pip

然后

conda env update -f test.yml -n test_pip

带有以下.yml文件(仅用于测试):

with the following .yml file (for test only):

channels:
- defaults
- conda-forge
dependencies:
- python=3.5
- numpy
- scipy
- scikit-learn
- jupyter
- ipykernel
- requests
- pandas
- seaborn
- click
- openpyxl
- matplotlib
- pip:
  - watermark
  - "-e git+https://github.com/slundberg/shap#egg=shap"
  - pytest
  - sklearn
  - autopep8

它工作正常,但是egg文件安装在当前目录"src/shap/"中,而我希望它与conda或pip安装的所有其他python软件包一起安装:

It works fine but the egg file is install in the current dir "src/shap/" while I would like to have it install with all other python packages installed by conda or pip:

/xxx/anaconda/envs/test_pip

我接受了这个测试github目录(我知道可以直接通过pip install安装它),但是我想稍后使用自己的git目录.

I took this test github directory (I know I can install it with pip install directly) but I would like to use later my own git directory.

为什么这里没有安装鸡蛋?

Why is the egg not installed here?

/xxx/anaconda/envs/test_pip/lib/python3.5/site-packages/

在这里可以找到pip和conda安装的其他软件包.

It is the place where I fin the other packages installed by pip and conda.

任何原因吗?我该如何更改?

Any reason for that ? How can I changed that ?

我正在使用:

anaconda 4.2.0
conda 4.5.1
pip 9.0.3

推荐答案

我在配置中看不到任何鸡蛋文件.如果通过蛋文件"来自github的git仓库比罪魁祸首是选项 -e -它以可编辑模式" 安装该软件包.您可能不需要它,所以配置部分应如下所示:

I don't see any egg file in your config. If by the "egg file" you mean git repository from github than the culprit is option -e — it installs the package in "editable mode". You probably don't need it, so the part of the config should look like this:

- pip:
    …
  - "git+https://github.com/slundberg/shap#egg=shap"
    …

PS.#egg = shap 并不意味着有一个鸡蛋文件,这只是一种方式在VCS(在您的情况下为git)URL中为 pip 命名软件包,以便 pip 在克隆存储库之前可以解析软件包名称和版本.

PS. #egg=shap doesn't mean there is an egg file, it's just the way to name the package for pip in VCS (git in your case) URLs so pip could resolve package names and versions before it clones the repositories.

这篇关于如何让github上的egg文件通过pip不在当前目录中安装,而在conda env目录中安装?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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