简体   繁体   中英

How to specify version ranges in Conda environment.yml

Is it possible to specify version ranges in an environment.yml file for Conda packages?

The official documentation mentions a few examples that rely on the asterisks (*) and I am wondering if that is the only feature or whether Conda supports other more sophisticated version ranges such as those supported by npm .

For example, is it possible to install any patch version that is higher or equal to 1.2.3 (eg, 1.2.10 would be fine but 1.3.0 is not)?

I think/assume that the syntax specifying versions is the one documented at Package match specifications .

So you would write - numpy >=1.2.3,<1.3 (space after numpy, no space after the comma - not tested).

BTW, I couldn't find any documentation describing the structure of the environment file environment.yml . creating-an-environment-from-an-environment-yml-file refers to Creating an environment file manually and vice-versa.

You could write something like:

dependencies:
  - numpy>=1.2.3, <1.3

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM