如何安装 flex 和 bison:错误无法找到文件

如何安装 flex 和 bison:错误无法找到文件

我尝试安装 flex 和 bison,但出现此错误:无法找到文件 & 我也使用软件中心来执行此操作,但出现验证错误。

我不知道应该选择哪种资源。当我在终端中运行此命令时:

sudo apt-get update

结果如下:

Failed to fetch http://archive.canonical.com/dists/lucid/Release.gpg  Unable to connect to 127.0.0.1:8080:

我的环境:

$ cat /etc/environment
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games"
http_proxy="http://127.0.0.1:8080/"
https_proxy="https://127.0.0.1:8080/"
ftp_proxy="ftp://127.0.0.1:8080/"
socks_proxy="socks://127.0.0.1:8080/"

$ /etc/apt/apt.conf
Acquire::http::proxy "http://127.0.0.1:8080/";
Acquire::https::proxy "https://127.0.0.1:8080/";
Acquire::ftp::proxy "ftp://127.0.0.1:8080/";
Acquire::socks::proxy "socks://127.0.0.1:8080/";

答案1

如果您的发行版是 Ubuntu Lucid。

测试一下:

打开终端,

Ctrl++AltT

运行:

sudo -i
nano /etc/apt/sources.list

在打开的文件中,删除内容并粘贴以下内容:

## Uncomment the following two lines to fetch updated software from the network
deb http://old-releases.ubuntu.com/ubuntu lucid main restricted
deb-src http://old-releases.ubuntu.com/ubuntu lucid main restricted

## Uncomment the following two lines to fetch major bug fix updates produced
## after the final release of the distribution.
deb http://old-releases.ubuntu.com/ubuntu lucid-updates main restricted
deb-src http://old-releases.ubuntu.com/ubuntu lucid-updates main restricted

## Uncomment the following two lines to add software from the 'universe'
## repository.
## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team, and may not be under a free licence. Please satisfy yourself as to
## your rights to use the software. Also, please note that software in
## universe WILL NOT receive any review or updates from the Ubuntu security
## team.
deb http://old-releases.ubuntu.com/ubuntu lucid universe
deb-src http://old-releases.ubuntu.com/ubuntu lucid universe

deb http://old-releases.ubuntu.com/ubuntu lucid-security main restricted
deb-src http://old-releases.ubuntu.com/ubuntu lucid-security main restricted

deb http://old-releases.ubuntu.com/ubuntu lucid-security universe
deb-src http://old-releases.ubuntu.com/ubuntu lucid-security universe

deb http://old-releases.ubuntu.com/ubuntu lucid multiverse
deb-src http://old-releases.ubuntu.com/ubuntu lucid multiverse

deb http://old-releases.ubuntu.com/ubuntu lucid-backports main restricted universe multiverse

Ctrl+ O,保存文件。Ctrl+ X,关闭 nano。

继续在终端中运行:

sudo -i
apt-get update
apt-get dist-upgrade
apt-get install flex bison
apt-get clean

如果您的发行版不是 Ubuntu Lucid,请将 Lucid 更改为适当的名称。

如果这些都不起作用

下载软件包(Lucid):

http://mirrors.kernel.org/ubuntu/pool/main/b/bison/bison_2.4.1.dfsg-3_i386.deb(32 位) http://mirrors.kernel.org/ubuntu/pool/main/b/bison/bison_2.4.1.dfsg-3_amd64.deb(64 位) http://mirrors.kernel.org/ubuntu/pool/main/f/flex/flex_2.5.35-9_i386.deb(32 位) http://mirrors.kernel.org/ubuntu/pool/main/f/flex/flex_2.5.35-9_amd64.deb(64 位)

并使用以下命令安装它们:

sudo -i
cd /home/user/Downloads
dpkg -i *.deb

答案2

由于某种原因,您已配置代理设置。假设您不需要它们,请打开“系统设置”,转到“网络”部分,将“代理设置”设置为“无”,然后单击应用于全系统

在此处输入图片描述

相关内容