Python Conda:直接从 github 安装/升级

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/19042389/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-19 12:38:16  来源:igfitidea点击:

Conda: Installing / upgrading directly from github

pythongithubpippackage-managersconda

提问by Amelio Vazquez-Reina

Can I install/upgrade packages from GitHub using conda?

我可以使用conda从 GitHub 安装/升级软件包吗?

For example, with pipI can do:

例如,pip我可以这样做:

pip install git+git://github.com/scrappy/scrappy@master

to install scrappydirectly from the masterbranch in GitHub. Can I do something equivalent with conda?

scrappy直接从masterGitHub 中的分支安装。我可以用 conda 做一些等效的事情吗?

If this is not possible, would it make any sense to install pip with conda and manage such local installations with pip?

如果这是不可能的,使用 conda 安装 pip 并使用 pip 管理此类本地安装是否有意义?

采纳答案by Aron Ahmadia

There's better support for this now through conda-env. You can, for example, now do:

现在通过conda-env. 例如,您现在可以执行以下操作:

name: sample_env
channels:
dependencies:
   - requests
   - bokeh>=0.10.0
   - pip:
     - "--editable=git+https://github.com/pythonforfacebook/facebook-sdk.git@8c0d34291aaafec00e02eaa71cc2a242790a0fcc#egg=facebook_sdk-master"

It's still calling pip under the covers, but you can now unify your conda and pip package specifications in a single environment.ymlfile.

它仍然在幕后调用 pip,但您现在可以在单个environment.yml文件中统一您的 conda 和 pip 包规范。

If you wanted to update your root environment with this file, you would need to save this to a file (for example, environment.yml), then run the command: conda env update -f environment.yml.

如果你想用这个文件更新你的根环境,你需要把它保存到一个文件中(例如,environment.yml),然后运行命令:conda env update -f environment.yml

It's more likely that you would want to create a new environment:

您更有可能想要创建一个新环境:

conda env create -f environment.yml(changed as supposed in the comments)

conda env create -f environment.yml(根据评论中的假设进行了更改)

回答by asmeurer

condadoesn't support this directly because it installs from binaries, whereas git install would be from source. conda builddoes support recipes that are built from git. On the other hand, if all you want to do is keep up-to-date with the latest and greatest of a package, using pip inside of Anaconda is just fine, or alternately, use setup.py developagainst a git clone.

conda不直接支持它,因为它从二进制文件安装,而 git install 将来自源代码。conda build确实支持从 git 构建的配方。另一方面,如果您只想了解最新和最好的软件包,在 Anaconda 中使用 pip 就可以了,或者,也可以setup.py develop针对 git clone 使用。

回答by Gabriel Fair

The answers are outdated. You simply have to conda install pip and git. Then you can use pip normally:

答案已经过时。您只需要 conda 安装 pip 和 git。然后就可以正常使用pip了:

  1. Activate your conda environment source activate myenv

  2. conda install git pip

  3. pip install git+git://github.com/scrappy/scrappy@master

  1. 激活您的 conda 环境 source activate myenv

  2. conda install git pip

  3. pip install git+git://github.com/scrappy/scrappy@master

回答by mmann1123

I found a reference to this in condas issues. The following should now work.

我在condas issues 中找到了对此的引用。以下应该现在工作。

name: sample_env
channels:
dependencies:
   - requests
   - bokeh>=0.10.0
   - pip:
     - git+https://github.com/pythonforfacebook/facebook-sdk.git