Python3中pip install smac报错,pip install pyrfr报错解决办法

 环境:python3.11;软件:vscode

Collecting pyrfr
  Using cached pyrfr-0.9.0.tar.gz (295 kB)
  Preparing metadata (setup.py) ... done
Building wheels for collected packages: pyrfr
  Building wheel for pyrfr (setup.py) ... error
  error: subprocess-exited-with-error

  × python setup.py bdist_wheel did not run successfully.
  │ exit code: 1
  ╰─> [6 lines of output]
      [<setuptools.extension.Extension('pyrfr._regression') at 0x224560e2d10>, <setuptools.extension.Extension('pyrfr._util') at 0x2245845ffd0>]
      Deprecated command line option: -modern. Ignored, this option is now always on.
      Deprecated command line option: -py3. Ignored, this option is no longer supported.
      .\include\rfr\nodes\k_ary_node.hpp(1) : Warning 401: Nothing known about base class 'k_ary_node_minimal< 2,rfr::splits::binary_split_one_feature_rss_loss< double,double,unsigned int,std::default_random_engine,128 >,double,double,unsigned int,std::default_random_engine >'. Ignored.
      .\include\rfr\nodes\k_ary_node.hpp(1) : Warning 401: Maybe you forgot to instantiate 'k_ary_node_minimal< 2,rfr::splits::binary_split_one_feature_rss_loss< double,double,unsigned int,std::default_random_engine,128 >,double,double,unsigned int,std::default_random_engine >' using %template.
      error: Microsoft Visual C++ 14.0 or greater is required. Get it with "Microsoft C++ Build Tools": https://visualstudio.microsoft.com/visual-cpp-build-tools/
      [end of output]

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

Microsoft Visual C++ 14.0 or greater is required. Get it with "Microsoft C++ Build Tools": https://visualstudio.microsoft.com/visual-cpp-build-tools/

报错原因:由于没有合适的C++版本用来对pyrfr包进行编译,需要安装Microsoft C++ build tools的拓展资源。

解决办法:可以使用离线资源进行安装(csdn上有资源,这种方式使用内存较小),也可以在上面的网址下载,打开官方安装器,进行安装(占据空间较大),选择C++官方工具。

依然安装失败,可能由于系统无SWIG软件,这里参考Openbox的解决方法:

  1. 从 SWIG 下载页面 下载 SWIG 的 Windows 版。 点击 All releases ,而后选择 ‘swigwin’ 文件夹。我们推荐安装版本 3.0.12。在下载后解压文件。

  2. 把 SWIG 文件夹添加到系统路径

完成SWIG的安装以及加入环境变量后,且上述C++环境已经满足,再在终端运行pip install pyrfr

然后安装成功,可以继续安装smac等包:

pip install smac

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值