在 Ubuntu 上,getconf 命令一般默认就已经安装了,它来自 libc-bin 包(glibc 相关工具)。
getconf --version
或
which getconf
如果能看到路径(通常是 /usr/bin/getconf),说明已经安装。
可以安装它所在的包:
sudo apt update
sudo apt install libc-bin
安装完成后即可使用:
getconf LONG_BIT
getconf -a
# 查看系统位数
getconf LONG_BIT
# 查看页面大小
getconf PAGESIZE
# 查看所有配置变量
getconf -a
getconf 不是通过 pip 或 snap 安装的libc-bin 即可解决如果你是在 Docker / 容器 / 云服务器 里遇到这个问题,也可以告诉我具体环境,我可以给你更精确的方案。