如何解決 Python 3.10 及以上版本安裝 PyRadiomics 時出現的錯誤:「此錯誤很可能表示您需要安裝一個提供 `cmatrices.h` 的函式庫」(適用於 PyRadiomics 3.0.1a1)

❯ uv add pyradiomics --active
Resolved 145 packages in 58ms
  × Failed to build `pyradiomics==3.1.0`
  ├─▶ The build backend returned an error
  ╰─▶ Call to `setuptools.build_meta.build_wheel` failed (exit status: 1)

      [stdout]
      Failed to load config from
      /Users/ww/.cache/uv/sdists-v9/index/20b3c93edffc1c13/pyradiomics/3.1.0/D0FpsOXrgpnyydIdW64yg/src/pyproject.toml:
      'tool'
      Try to load it from setup.cfg
      running bdist_wheel
      running build
      running build_py
      Failed to load config from
      /Users/ww/.cache/uv/sdists-v9/index/20b3c93edffc1c13/pyradiomics/3.1.0/D0FpsOXrgpnyydIdW64yg/src/pyproject.toml:
      'tool'
      Try to load it from setup.cfg
      Failed to load config from
      /Users/ww/.cache/uv/sdists-v9/index/20b3c93edffc1c13/pyradiomics/3.1.0/D0FpsOXrgpnyydIdW64yg/src/pyproject.toml:
      'tool'
      Try to load it from setup.cfg
      copying radiomics/featureextractor.py ->
      build/lib.macosx-11.0-arm64-cpython-313/radiomics
      copying radiomics/glcm.py ->
      build/lib.macosx-11.0-arm64-cpython-313/radiomics
      copying radiomics/shape2D.py ->
      build/lib.macosx-11.0-arm64-cpython-313/radiomics
      copying radiomics/gldm.py ->
      build/lib.macosx-11.0-arm64-cpython-313/radiomics
      copying radiomics/firstorder.py ->
      build/lib.macosx-11.0-arm64-cpython-313/radiomics
      copying radiomics/__init__.py ->
      build/lib.macosx-11.0-arm64-cpython-313/radiomics
      copying radiomics/ngtdm.py ->
      build/lib.macosx-11.0-arm64-cpython-313/radiomics
      copying radiomics/glrlm.py ->
      build/lib.macosx-11.0-arm64-cpython-313/radiomics
      copying radiomics/glszm.py ->
      build/lib.macosx-11.0-arm64-cpython-313/radiomics
      copying radiomics/imageoperations.py ->
      build/lib.macosx-11.0-arm64-cpython-313/radiomics
      copying radiomics/shape.py ->
      build/lib.macosx-11.0-arm64-cpython-313/radiomics
      copying radiomics/generalinfo.py ->
      build/lib.macosx-11.0-arm64-cpython-313/radiomics
      copying radiomics/base.py ->
      build/lib.macosx-11.0-arm64-cpython-313/radiomics
      copying radiomics/scripts/__init__.py ->
      build/lib.macosx-11.0-arm64-cpython-313/radiomics/scripts
      copying radiomics/scripts/voxel.py ->
      build/lib.macosx-11.0-arm64-cpython-313/radiomics/scripts
      copying radiomics/scripts/segment.py ->
      build/lib.macosx-11.0-arm64-cpython-313/radiomics/scripts
      copying radiomics/schemas/paramSchema.yaml ->
      build/lib.macosx-11.0-arm64-cpython-313/radiomics/schemas
      copying radiomics/schemas/schemaFuncs.py ->
      build/lib.macosx-11.0-arm64-cpython-313/radiomics/schemas
      UPDATING
      build/lib.macosx-11.0-arm64-cpython-313/radiomics/_version.py
      set build/lib.macosx-11.0-arm64-cpython-313/radiomics/_version.py
      to 'v3.1.0'
      running build_ext
      Failed to load config from
      /Users/ww/.cache/uv/sdists-v9/index/20b3c93edffc1c13/pyradiomics/3.1.0/D0FpsOXrgpnyydIdW64yg/src/pyproject.toml:
      'tool'
      Try to load it from setup.cfg
      Failed to load config from
      /Users/ww/.cache/uv/sdists-v9/index/20b3c93edffc1c13/pyradiomics/3.1.0/D0FpsOXrgpnyydIdW64yg/src/pyproject.toml:
      'tool'
      Try to load it from setup.cfg
      building 'radiomics._cmatrices' extension
      cc -fno-strict-overflow -Wsign-compare
      -Wunreachable-code -DNDEBUG -g -O3 -Wall -arch arm64
      -mmacosx-version-min=11.0 -Wno-nullability-completeness
      -Wno-expansion-to-defined -Wno-undef-prefix -fPIC
      -I/Users/ww/.local/share/uv/python/cpython-3.13.5-macos-aarch64-none/include/python3.13
      -I/Users/ww/.cache/uv/builds-v0/.tmpz1p8Fx/lib/python3.13/site-packages/numpy/_core/include
      -I/Users/ww/.cache/uv/builds-v0/.tmpz1p8Fx/include
      -I/Users/ww/.local/share/uv/python/cpython-3.13.5-macos-aarch64-none/include/python3.13
      -c radiomics/src/_cmatrices.c -o
      build/temp.macosx-11.0-arm64-cpython-313/radiomics/src/_cmatrices.o

      [stderr]
      /Users/ww/.cache/uv/builds-v0/.tmpz1p8Fx/lib/python3.13/site-packages/setuptools/dist.py:332:
      InformationOnly: Normalizing 'v3.1.0' to '3.1.0'
        self.metadata.version =
      self._normalize_version(self.metadata.version)
      /Users/ww/.cache/uv/builds-v0/.tmpz1p8Fx/lib/python3.13/site-packages/setuptools/config/_apply_pyprojecttoml.py:82:
      SetuptoolsDeprecationWarning: `project.license` as a TOML table
      is deprecated
      !!

      
      ********************************************************************************
              Please use a simple string containing a SPDX expression for
      `project.license`. You can also use `project.license-files`. (Both
      options available on setuptools>=77.0.0).

              By 2027-Feb-18, you need to update your project and remove
      deprecated calls
              or your builds will no longer be supported.

              See
      https://packaging.python.org/en/latest/guides/writing-pyproject-toml/#license
      for details.
      
      ********************************************************************************

      !!
        corresp(dist, value, root_dir)
      /Users/ww/.cache/uv/builds-v0/.tmpz1p8Fx/lib/python3.13/site-packages/setuptools/config/_apply_pyprojecttoml.py:82:
      SetuptoolsWarning: `install_requires` overwritten in
      `pyproject.toml` (dependencies)
        corresp(dist, value, root_dir)
      /Users/ww/.cache/uv/builds-v0/.tmpz1p8Fx/lib/python3.13/site-packages/setuptools/config/_apply_pyprojecttoml.py:61:
      SetuptoolsDeprecationWarning: License classifiers are deprecated.
      !!

      
      ********************************************************************************
              Please consider removing the following classifiers in favor
      of a SPDX license expression:

              License :: OSI Approved :: BSD License

              See
      https://packaging.python.org/en/latest/guides/writing-pyproject-toml/#license
      for details.
      
      ********************************************************************************

      !!
        dist._finalize_license_expression()
      /Users/ww/.cache/uv/builds-v0/.tmpz1p8Fx/lib/python3.13/site-packages/setuptools/dist.py:765:
      SetuptoolsDeprecationWarning: License classifiers are deprecated.
      !!

      
      ********************************************************************************
              Please consider removing the following classifiers in favor
      of a SPDX license expression:

              License :: OSI Approved :: BSD License

              See
      https://packaging.python.org/en/latest/guides/writing-pyproject-toml/#license
      for details.
      
      ********************************************************************************

      !!
        self._finalize_license_expression()
      radiomics/src/_cmatrices.c:6:10: fatal error: 'cmatrices.h' file
      not found
          6 | #include "cmatrices.h"
            |          ^~~~~~~~~~~~~
      1 error generated.
      error: command '/usr/bin/cc' failed with exit code 1

      hint: This error likely indicates that you need to install a library
      that provides "cmatrices.h" for `pyradiomics@3.0.1a1`
  help: If you want to add the package regardless of the failed
        resolution, provide the `--frozen` flag to skip locking and
        syncing.

解决办法

自己下载源码然后本机安装

pip install git+https://github.com/AIM-Harvard/pyradiomics@v3.1.0

参考