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

2024-04-24 05:52:55 发布

您现在位置:Python中文网/ 问答频道 /正文

我正在尝试在共享主机上安装新的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//.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不允许在其共享帐户上使用gcc:http://support.hostgator.com/articles/pre-sales-questions/compatible-technologies


Tags: noinhttphomeforprefixmakeconfigure
3条回答

对于Ubuntu/Debian:

# sudo apt-get install build-essential

对于RHEL/CentOS

#rpm -qa | grep gcc
# yum install gcc glibc glibc-common gd gd-devel -y

或者

 # yum groupinstall "Development tools" -y

更多详细信息请参阅link

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

要安装gcc,请使用以下命令:(以根用户身份运行)

  • 红帽底座:

    yum groupinstall "Development Tools"
    
  • Debian基础:

    apt-get install build-essential
    

你得跑了

yum install gcc

相关问题 更多 >