在Windows 11上使用pip安装cantera时缺少Boost头文件

2 投票
1 回答
37 浏览
提问于 2025-04-12 17:44

我尝试在Windows 11上用这个命令安装cantera这个库:

py -m pip install cantera

但是我遇到了以下错误:

Defaulting to user installation because normal site-packages is not writeable
Collecting cantera
  Using cached Cantera-3.0.0.tar.gz (5.3 MB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... done
Requirement already satisfied: numpy>=1.12.0 in c:\users\benzinm\appdata\roaming\python\python312\site-packages (from cantera) (1.26.2)
Collecting ruamel.yaml>=0.15.34 (from cantera)
  Using cached ruamel.yaml-0.18.6-py3-none-any.whl.metadata (23 kB)
Requirement already satisfied: packaging in c:\users\benzinm\appdata\roaming\python\python312\site-packages (from cantera) (23.2)
Collecting ruamel.yaml.clib>=0.2.7 (from ruamel.yaml>=0.15.34->cantera)
  Using cached ruamel.yaml.clib-0.2.8-cp312-cp312-win_amd64.whl.metadata (2.3 kB)
Using cached ruamel.yaml-0.18.6-py3-none-any.whl (117 kB)
Using cached ruamel.yaml.clib-0.2.8-cp312-cp312-win_amd64.whl (115 kB)
Building wheels for collected packages: cantera
  Building wheel for cantera (pyproject.toml) ... error
  error: subprocess-exited-with-error

  × Building wheel for cantera (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [19 lines of output]
      Traceback (most recent call last):
        File "C:\Users\BenzinM\AppData\Roaming\Python\Python312\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 353, in <module>
          main()
        File "C:\Users\BenzinM\AppData\Roaming\Python\Python312\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 335, in main
          json_out['return_val'] = hook(**hook_input['kwargs'])
                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "C:\Users\BenzinM\AppData\Roaming\Python\Python312\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 251, in build_wheel
          return _build_backend().build_wheel(wheel_directory, config_settings,
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "C:\Users\BenzinM\AppData\Local\Temp\pip-build-env-y5n0f8ns\overlay\Lib\site-packages\setuptools\build_meta.py", line 410, in build_wheel
          return self._build_with_temp_dir(
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "C:\Users\BenzinM\AppData\Local\Temp\pip-build-env-y5n0f8ns\overlay\Lib\site-packages\setuptools\build_meta.py", line 395, in _build_with_temp_dir
          self.run_setup()
        File "C:\Users\BenzinM\AppData\Local\Temp\pip-build-env-y5n0f8ns\overlay\Lib\site-packages\setuptools\build_meta.py", line 311, in run_setup
          exec(code, locals())
        File "<string>", line 166, in <module>
        File "<string>", line 126, in configure_build
      ValueError: Could not find Boost headers. Please set an environment variable called BOOST_INCLUDE that contains the path to the Boost headers.
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for cantera
Failed to build cantera
ERROR: Could not build wheels for cantera, which is required to install pyproject.toml-based projects

然后我下载了Boost的头文件,把它们解压到C:\boost这个文件夹里,并设置了用户变量:

C:\Users\BenzinM>echo %BOOST_INCLUDE%
C:\boost

但还是出现了同样的错误。我得提一下,我没有管理员权限。有人能帮帮我吗?

1 个回答

暂无回答

撰写回答