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

我正在尝试在共享主机上安装新的python环境。我按照这篇文章写的步骤:

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

I’m trying to install new python environment on my shared hosting. I follow the steps written in 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

After coming to “./configure –prefix=/home//.localpython” command I get the following output:

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.

How can this problem be solved? I’ve been trying to find a solution for 3 hours but still stuck in one place.

UPDATE

Hostgator does not allow gcc on their shared accounts: http://support.hostgator.com/articles/pre-sales-questions/compatible-technologies


回答 0

gcc编译器不在您的中$PATH。这意味着您没有安装gcc或不在$ PATH变量中。

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

  • Redhat基础:

    yum groupinstall "Development Tools"
  • Debian基础:

    apt-get install build-essential

The gcc compiler is not in your $PATH. It means either you dont have gcc installed or it’s not in your $PATH variable.

To install gcc use this: (run as root)

  • Redhat base:

    yum groupinstall "Development Tools"
    
  • Debian base:

    apt-get install build-essential
    

回答 1

你需要跑步

yum install gcc

you need to run

yum install gcc

回答 2

对于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

更多细节请参考链接

for Ubuntu / Debian :

# sudo apt-get install build-essential

For RHEL/CentOS

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

or

 # yum groupinstall "Development tools" -y

More details refer the link


回答 3

您将需要运行

sudo apt-get install build-essential

首先假设您使用的是debain / ubuntu系统

You will need to run

sudo apt-get install build-essential

first assuming you’re on a debain/ubuntu system


回答 4

由于它是共享主机,因此您需要以非root用户身份安装它。这是一个指示如何执行此步骤的Tut。 http://luiarthur.github.io/gccinstall

cd ~/src
wget http://www.netgull.com/gcc/releases/gcc-5.2.0/gcc-5.2.0.tar.gz

或等效的gcc来源,然后

tar -xvf gcc-5.2.0.tar.gz
cd gcc-5.2.0
./contrib/download_prerequisites
cd ..
mkdir objdir
cd objdir
$PWD/../gcc-5.2.0/configure --prefix=$HOME/gcc-5.2.0 --enable-languages=c,c++,fortran,go
make
make install

然后添加到.bashrc或等效文件

export PATH=~/gcc-5.2.0/bin:$PATH
export LD_LIBRARY_PATH=~/gcc-5.2.0/lib:$LD_LIBRARY_PATH
export LD_LIBRARY_PATH=~/gcc-5.2.0/lib64:$LD_LIBRARY_PATH

You would need to install it as non root, since its shared hosting. Here is a tut that points how this step. http://luiarthur.github.io/gccinstall

cd ~/src
wget http://www.netgull.com/gcc/releases/gcc-5.2.0/gcc-5.2.0.tar.gz

or equivalent gcc source, then

tar -xvf gcc-5.2.0.tar.gz
cd gcc-5.2.0
./contrib/download_prerequisites
cd ..
mkdir objdir
cd objdir
$PWD/../gcc-5.2.0/configure --prefix=$HOME/gcc-5.2.0 --enable-languages=c,c++,fortran,go
make
make install

then add to .bashrc, or equivalent

export PATH=~/gcc-5.2.0/bin:$PATH
export LD_LIBRARY_PATH=~/gcc-5.2.0/lib:$LD_LIBRARY_PATH
export LD_LIBRARY_PATH=~/gcc-5.2.0/lib64:$LD_LIBRARY_PATH

回答 5

如果将Alphine与docker结合使用,请执行以下操作:

apk --update add gcc make g++ zlib-dev

If you are using alphine with docker, do this:

apk --update add gcc make g++ zlib-dev

回答 6

让有权访问该服务器上的root帐户的人运行sudo apt-get install build-essential。如果您不知道谁有权访问根目录,请与支持团队联系以获取共享主机并询问他们。

编辑:如果不允许访问root用户,则永远不会使它工作。恐怕您必须更改托管服务提供商。

Get someone with access to the root account on that server to run sudo apt-get install build-essential. If you don’t know who has root access, contact the support team for your shared hosting and ask them.

Edit: If you aren’t allowed access to root, you aren’t ever going to get it working. You’ll have to change hosting provider I’m afraid.


回答 7

apt-get install gcc在Suse Linux中运行

Run apt-get install gcc in Suse Linux


回答 8

sudo apt install build-essential 是命令

但是如果得到“ 可以找到该软件包 ”的错误,请运行

  • sudo apt update 第一
  • 然后 sudo apt install build-essential

这对我有用。

sudo apt install build-essential is the command

But if you get the “the package can be found” kind of error, Run

  • sudo apt update first
  • then sudo apt install build-essential

This worked for me.


回答 9

在Arch Linux上,运行以下命令:

sudo pacman -S base-devel

On Arch Linux run the following:

sudo pacman -S base-devel


声明:本站所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。