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

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/19816275/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-19 14:41:42  来源:igfitidea点击:

no acceptable C compiler found in $PATH when installing python

pythoncompiler-errorsvirtualenv

提问by mik.ro

I'm trying to install new python environment on my shared hosting. I follow the steps written in this post:

我正在尝试在我的共享主机上安装新的 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

After coming to "./configure --prefix=/home//.localpython" command I get the following output:

进入“./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.

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

如何解决这个问题?我一直试图找到一个解决方案 3 个小时,但仍然卡在一个地方。

UPDATE

更新

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

Hostgator 不允许在他们的共享帐户上使用 gcc:http: //support.hostgator.com/articles/pre-sales-questions/compatible-technologies

回答by Tom Swifty

You will need to run

你需要运行

sudo apt-get install build-essential

first assuming you're on a debain/ubuntu system

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

回答by wdh

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.

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

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.

编辑:如果您不被允许访问 root,您将永远无法使用它。恐怕您必须更换托管服务提供商。

回答by vahid abdi

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

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

To install gcc use this: (run as root)

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

  • Redhat base:

    yum groupinstall "Development Tools"
    
  • Debian base:

    apt-get install build-essential
    
  • 红帽基地:

    yum groupinstall "Development Tools"
    
  • Debian 基础:

    apt-get install build-essential
    

回答by mlowton

you need to run

你需要跑

yum install gcc

回答by lakshmikandan

for Ubuntu / Debian :

对于 Ubuntu / Debian :

# sudo apt-get install build-essential

For RHEL/CentOS

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

更多详情请参考链接

回答by user6735634

On Arch Linux run the following:

在 Arch Linux 上运行以下命令:

sudo pacman -S base-devel

sudo pacman -S base-devel

回答by blamb

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

您需要以非 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

or equivalent gcc source, then

或等效的 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

then add to .bashrc, or equivalent

然后添加到 .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

回答by Sahith Vibudhi

If you are using alphine with docker, do this:

如果您将 alphine 与 docker 一起使用,请执行以下操作:

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

回答by Black

Run apt-get install gccin Suse Linux

apt-get install gcc在 Suse Linux 中运行

回答by Mbigha Siggi

sudo apt install build-essentialis the command

sudo apt install build-essential是命令

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

但是如果你得到“可以找到包”这样的错误,运行

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

This worked for me.

这对我有用。