以下是pycubes在conda环境安装的报错结果,请问可能的解决方案是什么? mcubes/src/pywrapper.cpp:59:104: error:…
- User
以下是pycubes在conda环境安装的报错结果,请问可能的解决方案是什么? mcubes/src/pywrapper.cpp:59:104: error: ‘PyArray_DOUBLE’ was not declared in this scope; did you mean ‘PyArray_DTYPE’? 59 | PyArrayObject* verticesarr = reinterpret_cast<PyArrayObject*>(PyArray_SimpleNew(1, &size_vertices, PyArray_DOUBLE)); | ^~~~~~~~~~~~~~ /home/fl/tmp/pip-install-49sdkk9t/pymcubes_ce13ddd6d9a14dec8671ef830f99675c/.eggs/numpy-2.1.1-py3.10-linux-x86_64.egg/numpy/_core/include/numpy/ndarrayobject.h:119:46: note: in definition of macro ‘PyArray_SimpleNew’ 119 | PyArray_New(&PyArray_Type, nd, dims, typenum, NULL, NULL, 0, 0, NULL) | ^~~~~~~ mcubes/src/pywrapper.cpp:60:104: error: ‘PyArray_ULONG’ was not declared in this scope; did you mean ‘PyArray_FLAGS’? 60 | PyArrayObject* polygonsarr = reinterpret_cast<PyArrayObject*>(PyArray_SimpleNew(1, &size_polygons, PyArray_ULONG)); | ^~~~~~~~~~~~~ /home/fl/tmp/pip-install-49sdkk9t/pymcubes_ce13ddd6d9a14dec8671ef830f99675c/.eggs/numpy-2.1.1-py3.10-linux-x86_64.egg/numpy/_core/include/numpy/ndarrayobject.h:119:46: note: in definition of macro ‘PyArray_SimpleNew’
- Assistant
根据您提供的错误信息,出现
‘PyArray_DOUBLE’ was not declared in this scope和‘PyArray_ULONG’ was not declared in this scope的错误,这是由于在较新的 NumPy 版本中,这些宏常量已经被移除或重命名。问题原因:
- NumPy 版本不兼容:在 NumPy 1.20.0 及更高版本中,
PyArray_DOUBLE和PyArray_ULONG等宏常量已经被移除,取而代之的是NPY_DOUBLE和NPY_ULONG。
解决方案:
-
降级 NumPy 版本:
如果可以接受使用较低版本的 NumPy,可以将 NumPy 降级到 1.19 或更低的版本。您可以使用以下命令:
- NumPy 版本不兼容:在 NumPy 1.20.0 及更高版本中,