通过environment.yml安装带有conda的npm软件包 [英] Install npm package with conda via environment.yml

查看:77
本文介绍了通过environment.yml安装带有conda的npm软件包的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道是否可以通过conda的 environment.yml 文件直接安装npm软件包.我知道可以直接使用 pip 安装 pypi 软件包,如下所示:

I am wondering if it's possible to install npm packages directly through conda's environment.yml file. I know one can install pypi packages with pip directly as follows:

name: docs
channels:
  - conda-forge

dependencies:
  - python>=3.7
  - nodejs=10.*
  - pip
  - pip:
    - Sphinx==1.6.5

我尝试添加 npm 作为依赖项,因为它是通过 nodejs 安装的,但是不幸的是,它不起作用.

I've tried adding npm as a dependency as it's installed via nodejs but that doesn't work, unfortunately.

name: docs
channels:
  - conda-forge

dependencies:
  - python>=3.7
  - nodejs=10.*
  - pip
  - pip:
    - Sphinx==1.6.5
  - npm:
    - jsdoc

☝️不起作用.

我知道我可以在使用 npm install -g jsdoc 安装conda环境之后安装 jsdoc ,但是我很好奇是否有一种集成安装的方法.

I know I can install jsdoc after installing the conda environment using npm install -g jsdoc but I am curious if there's a way to integrate the installation.

推荐答案

在早期,整合其他专业软件包管理器的想法浮出水面,但我认为 pip 集成的问题经历表明,这样做将是一项艰巨的任务.并不是说安装机制会很困难,而是要防止各种程序包管理器相互破坏对方的程序包.因此,不,这不是一回事,很可能不会再有一段时间了.

In the early days, the idea of integrating other specialized package managers was floated, but I think the problematic experience with pip integration has indicated that doing so would be a Herculean task. It's not that setting up the installation mechanism would be hard, it's the safeguarding against the various package managers clobbering each other's packages. So, no it's not a thing and likely won't be for a while.

或者,如果确实需要在环境中安装NPM软件包(即通过YAML安装),则可以为它编写依赖于 nodejs 的Conda软件包,而只需执行<在构建脚本中调用code> npm install .

Alternatively, if one really needed to have an NPM package in an env (i.e., installed via the YAML), one could write a Conda package for it that depended on nodejs and simply did an npm install call in the build script.

这篇关于通过environment.yml安装带有conda的npm软件包的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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