如何让 gcc 在 CentOS 7 上运行?

如何让 gcc 在 CentOS 7 上运行?

我正在运行 CentOS 7。我想用我刚刚安装的新 openssl 包重新构建 Python,但我似乎无法编译它。我跑了这个

sudo yum groupinstall "Development Tools"

运行成功。但是当我在构建Python时运行./configure时,我遇到了问题......

(venv) [rails@server Python-3.7.0]$ ./configure
checking build system type... x86_64-pc-linux-gnu
checking host system type... x86_64-pc-linux-gnu
checking for python3.7... python3.7
checking for --enable-universalsdk... no
checking for --with-universal-archs... no
checking MACHDEP... checking for --without-gcc... no
checking for --with-icc... no
checking for gcc... gcc
checking whether the C compiler works... no
configure: error: in `/tmp/Python-3.7.0':
configure: error: C compiler cannot create executables

构建 Python 3 还需要做什么?

编辑:根据评论要求提供信息...

(venv) [rails@server Python-3.7.0]$ findmnt --target /tmp/Python-3.7.0
TARGET SOURCE                             FSTYPE OPTIONS
/      /dev/simfs[/home/vz/private/20428] simfs  rw,relatime

答案1

在尝试构建 Python 之前,您应该离开虚拟环境,因为 venv 会大量修改您的环境。您的提示表明您位于 Python 虚拟环境中。

当配置失败时,它通常会将具体的错误消息写入日志文件。检查该日志文件以查找根本原因。

CentOS 7 的最新版本包含 dnf,您只需使用以下命令即可安装构建要求:

dnf builddep python3

相关内容