conda应该如何处理头文件?

ben*_*min 5 python linux header-files conda

Trying to install a python library that depends on a C library header file. Currently, if I try:

conda install hdf5
pip install bitshuffle
Run Code Online (Sandbox Code Playgroud)

Then I get a gcc error, regarding inability to locate hdf5.h

Note, conda has downloaded hdf5.h (to envs/myenv/include), and as a work-around in this case there exists an alternative channel from which conda can install bitshuffle.

Is it recommended practice to conda install gcc rather than using (or letting pip use) the system default compiler? Should conda activate prepend its include directory to an environment variable used by common compilers? Is it bad practice to combine conda and pip usage?

mer*_*erv 1

我发现Conda Forge 的软件包(例如 )相对*-compiler容易c-compiler使用,并且它们的行为与您所描述的完全一样。也就是说,只要激活环境,它们就会自动添加环境include和lib文件夹作为编译器的搜索位置。从技术上讲,它们的主要用途是构建 Conda Forge 包,但我使用它们作为本地构建的编译器没有任何问题。

如果您仍然想使用自己的系统级编译器,那么您可以手动创建自己的激活脚本来模仿*-compiler包的功能(例如,更改CLFAGS和LDFLAGS_LD)。

我想说推荐的做法是保持环境尽可能独立。这样做的优点是,可以创建部署到多个平台(例如osx-64和linux-64)的环境定义 (YAML),并可以使用相同的命令构建软件。另外,如果您构建了与 兼容的代码,那么*-compilers您基本上已经设置了一个简单的转换来将该代码本身打包到 Conda 包中。

最后,应该指出的是,有问题的原始包现在位于 Conda Forge 上。显示meta.yaml了哪些包足以构建该包的环境。