You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Windows下配置带Arrow支持的Rust Polars遇构建及依赖问题

解决方案

一、正确配置Polars特性并排除zstd

在Polars 0.36.2版本中,polars::prelude::IpcWriter需要同时启用polars-io和ipc特性,而默认情况下ipc特性会依赖zstd。如果要排除zstd,需在Cargo.toml中通过显式控制依赖特性实现:

polars = { 
    version = "0.36.2", 
    default-features = false,
    features = [
        "polars-io", 
        "ipc",
        # 按需添加你需要的核心特性,例如:
        "dataframe",
        "series",
        "arrow" # 保留Arrow支持
    ]
}

# 显式禁用arrow-ipc的zstd特性(Polars 0.36.2依赖arrow-ipc 47.0.0)
arrow-ipc = { version = "47.0.0", default-features = false, features = ["parquet"] }

二、修复zstd-sys构建失败问题

如果无需排除zstd,仅需解决构建失败,通常是缺少系统级的zstd开发依赖:

  • Linux(Debian/Ubuntu系):
    sudo apt-get install libzstd-dev
    
  • Linux(RHEL/CentOS系):
    sudo yum install libzstd-devel
    
  • macOS:
    brew install zstd
    
  • Windows:通过vcpkg安装zstd库,或下载预编译的zstd二进制文件并配置环境变量,确保构建工具能找到头文件与库文件。

若为交叉编译或特殊环境,可强制zstd-sys静态链接zstd:

zstd-sys = { version = "2.0.9", features = ["static"] }

内容的提问来源于stack exchange,提问作者mentics

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.02 13:22:44