0%

occupancy_networks_因无法安装pytorch1

自动摘要: 这是因为pykdtree的构建错误是用C(不是C++)编写的。 我不清楚pytorch的机制,但我发现在pytorch1.0.0中,BuildExtension模块将调用gcc来编译应该没问 ……..

这是因为pykdtree的构建错误是用C(不是C++)编写的。
我不清楚pytorch的机制,但我发现在pytorch 1.0.0中,BuildExtension模块将调用gcc来编译应该没问题的C代码。在 pytorch 1.8.1 中,BuildExtension 模块将调用 c++ 进行编译,这将由于类型检查或其他一些语法问题而导致错误。

所以解决方案是编写另一个setup_c.py来编译使用标准build_ext模块的pykdtree模块。
代码如下:

1
2
3
4
5
6
7
8
9
10
11
12
13
14

from setuptools.command.build_ext import build_ext

ext_modules = [
pykdtree,
]

setup(
ext_modules = cythonize(ext_modules),
include_dirs=[numpy.get_include()],
cmd_class={
'build_ext': build_ext
}
)

欢迎关注我的其它发布渠道