简体   繁体   English

使用 conda build 一次性构建 win32 和 win64 包

[英]Using conda build to build win32 and win64 packages in 1 go

My pure python scripts are 32 bits or 64 bits agnostic but my dependencies are not.我的纯 python 脚本是 32 位或 64 位不可知的,但我的依赖项不是。 I want to use cython to speed up some functions making the package not pure python.我想使用 cython 来加速一些使包不是纯 python 的函数。 And I want to use them on windows with python 32 bits or 64 bits.我想在带有 python 32 位或 64 位的 Windows 上使用它们。

Is there a way to build with 1 conda recipe a conda python package for win32 and win64 platforms?有没有办法用 1 个 conda recipe 构建一个用于win32win64平台的 conda python 包?

One would assume that runtime dependencies (eg Numpy, etc.) are available for both platforms.人们会假设运行时依赖项(例如 Numpy 等)可用于两个平台。 Setup could either start from a miniconda 32 or 64 bits installation.安装程序可以从 miniconda 32 位或 64 位安装开始。

I have read the documentation differentiating the build , host requirements in meta.yaml, the conda build variants, and the architecture virtual packages but I am struggling to see if a clever combination of these functionalities would allow me to build both packages in one go.我已经阅读了区分 meta.yaml 中的buildhost要求、conda 构建变体和架构虚拟包的文档,但我正在努力了解这些功能的巧妙组合是否能让我一次性构建这两个包。

Thanks!谢谢!

Edit: This doesn't work编辑:这不起作用


Is there a way to build with 1 conda recipe a conda python package for win32 and win64 platforms?有没有办法用 1 个 conda recipe 构建一个用于 win32 和 win64 平台的 conda python 包?

conda convert --platform all for the lazy execution, or build it on 64-bit and conda convert --platform win-32 to get just the two builds you ask for. conda convert --platform all用于延迟执行,或者在 64 位上构建它并conda convert --platform win-32以获得您要求的两个构建。

https://docs.conda.io/projects/conda-build/en/latest/resources/commands/conda-convert.html https://docs.conda.io/projects/conda-build/en/latest/resources/commands/conda-convert.html

This is technically two steps (build and convert) but it could be wrapped into another script to do in one go.这在技术上是两个步骤(构建和转换),但可以将其包装到另一个脚本中一次性完成。

After a few experimentations, I found the solution to my question.经过几次实验,我找到了我的问题的解决方案。 If you put the following in conda_build_config.yaml :如果您将以下内容放入conda_build_config.yaml

target_platform:
  - win-32
  - win-64

And make sure you're using the Jinja compiler functions in the requirements/build: section of the recipe meta.yaml :并确保您在配方meta.yamlrequirements/build:部分使用 Jinja 编译器函数:

build:
  - {{ compiler('c')  }}
  - {{ compiler('cxx')  }}

then conda build will build both win-32 and win-64 packages in one go.然后conda build将一次性构建win-32win-64软件包。 (I used conda-build 64 bits but i do not think it matters). (我使用conda-build 64 位,但我认为这无关紧要)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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