问题:Conda:直接从github安装/升级

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

例如,pip我可以这样做:

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

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

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

Can I install/upgrade packages from GitHub using conda?

For example, with pip I can do:

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

to install scrappy directly from the master branch in GitHub. Can I do something equivalent with conda?

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


回答 0

现在,对此有了更好的支持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"

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

如果要使用此文件更新根环境,则需要将其保存到文件中(例如environment.yml),然后运行命令:conda env update -f environment.yml

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

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

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

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.yml file.

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.

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)


回答 1

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

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

  2. conda install git pip

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

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

  1. Activate your conda environment source activate myenv

  2. conda install git pip

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


回答 2

conda不直接支持此功能,因为它是从二进制文件安装的,而git install是从源代码安装的。conda build确实支持从git构建的配方。另一方面,如果您要做的只是保持最新和最新的软件包,则在Anaconda中使用pip很好,或者替代地,setup.py develop对git克隆使用。

conda doesn’t support this directly because it installs from binaries, whereas git install would be from source. conda build does 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 develop against a git clone.


回答 3

我在condas问题中找到了对此的参考。现在应该可以进行以下操作。

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

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

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

声明:本站所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。