python - 安装 python 时在 $PATH 中找不到可接受的 C 编译器

我正在尝试在我的共享主机上安装新的 Python 环境。我按照 this post 中的步骤进行操作:

mkdir ~/src
wget http://www.python.org/ftp/python/2.7.1/Python-2.7.1.tgz
tar -zxvf Python-2.7.1.tar.gz
cd Python-2.7.1
mkdir ~/.localpython
./configure --prefix=/home/<user>/.localpython
make
make install

来到./configure --prefix=/home/<user>/.localpython后命令,我得到以下输出:

checking for --enable-universalsdk... no
checking for --with-universal-archs... 32-bit
checking MACHDEP... linux3
checking EXTRAPLATDIR... 
checking machine type as reported by uname -m... x86_64
checking for --without-gcc... no
checking for gcc... no
checking for cc... no
checking for cl.exe... no
configure: error: in `/home3/mikos89/Python-2.7.1':
configure: error: no acceptable C compiler found in $PATH
See `config.log' for more details.

如何解决这个问题?我已经尝试了 3 个小时来寻找解决方案,但我仍然卡在一个地方。

更新

Hostgator does not allow gcc在他们的共享帐户上:

最佳答案

gcc 编译器不在您的 $PATH 中。 这意味着要么你没有安装 gcc,要么它不在你的 $PATH 变量中。

要安装 gcc,请使用:(以 root 身份运行)

  • 红帽基地:

     yum groupinstall "Development Tools"
    
  • Debian 基础:

     apt-get install build-essential
    
  • openSUSE 基础:

     zypper install --type pattern devel_basis
    
  • 阿尔卑斯山:

     apk add build-base
    

https://stackoverflow.com/questions/19816275/

相关文章:

linux - 在 Unix 中,我可以在一个目录中运行 'make' 而不先 cd'ing 到那个

linux - grep 不显示路径/文件 :line

python - 字典和默认值

python - 仅列出当前目录中的文件

python - 省略号 [...] 在列表中是什么意思?

regex - 用 grep 匹配一行中的两个字符串

python - 如何从 Python 中的函数返回两个值?

python - numpy.random.seed(0) 做什么?

linux - 如何为 wget 设置代理?

c - socket编程中AF_INET和PF_INET有什么区别?