运行“sudo apt-get clean”并恢复 sources.list 后无法找到并安装包

运行“sudo apt-get clean”并恢复 sources.list 后无法找到并安装包

当前终端输出:

sudo apt-get install tesseract-ocr
    Reading package lists... Done
    Building dependency tree       
    Reading state information... Done
    E: Unable to locate package tesseract-ocr

最初,我尝试在 16.04 上安装 tesseract-ocr。由于某些库未找到或不是最新的,因此无法安装软件包。我运行sudo apt-get update安装最新的库并发现存在一些错误 - 尤其是 /etc/app/sources.list 中的重复错误。

网上有一个建议是运行sudo apt-get clean。我运行了那个,但后来,从记忆中,我遇到了运行时无法再找到包的问题sudo apt-get install <package>。我遵循了这些指示仔细检查该包是否可用,然后将 sources.list 文件恢复为标准配置。

我的 /etc/app/sources.list 文件如下。

sudo apt-get update&&sudo apt-get install <package>仍然找不到该软件包 —— 即使它已在该版本中列出。

    # deb cdrom:[Ubuntu-Server 16.04 LTS _Xenial Xerus_ - Release amd64 (20160420.3)]/ xenial main restricted
deb-src http://archive.ubuntu.com/ubuntu xenial main restricted #Added by software-properties

# deb cdrom:[Ubuntu-Server 16.04 LTS _Xenial Xerus_ - Release amd64 (20160420.3)]/ xenial main restricted

# See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to
# newer versions of the distribution.
deb http://nz.archive.ubuntu.com/ubuntu/ xenial main restricted
deb-src http://nz.archive.ubuntu.com/ubuntu/ xenial main restricted

## Major bug fix updates produced after the final release of the
## distribution.
deb http://nz.archive.ubuntu.com/ubuntu/ xenial-updates main restricted
deb-src http://nz.archive.ubuntu.com/ubuntu/ xenial-updates main restricted

## 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://nz.archive.ubuntu.com/ubuntu/ xenial universe
deb-src http://nz.archive.ubuntu.com/ubuntu/ xenial universe
deb http://nz.archive.ubuntu.com/ubuntu/ xenial-updates universe
deb-src http://nz.archive.ubuntu.com/ubuntu/ xenial-updates universe

## 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 
## multiverse WILL NOT receive any review or updates from the Ubuntu
## security team.
deb http://nz.archive.ubuntu.com/ubuntu/ xenial multiverse
deb-src http://nz.archive.ubuntu.com/ubuntu/ xenial multiverse
deb http://nz.archive.ubuntu.com/ubuntu/ xenial-updates multiverse
deb-src http://nz.archive.ubuntu.com/ubuntu/ xenial-updates multiverse

## N.B. software from this repository may not have been tested as
## extensively as that contained in the main release, although it includes
## newer versions of some applications which may provide useful features.
## Also, please note that software in backports WILL NOT receive any review
## or updates from the Ubuntu security team.
deb http://nz.archive.ubuntu.com/ubuntu/ xenial-backports main restricted universe multiverse
deb-src http://nz.archive.ubuntu.com/ubuntu/ xenial-backports main restricted universe multiverse

## Uncomment the following two lines to add software from Canonical's
## 'partner' repository.
## This software is not part of Ubuntu, but is offered by Canonical and the
## respective vendors as a service to Ubuntu users.
# deb http://archive.canonical.com/ubuntu xenial partner
# deb-src http://archive.canonical.com/ubuntu xenial partner

deb http://security.ubuntu.com/ubuntu xenial-security main restricted
deb-src http://security.ubuntu.com/ubuntu xenial-security multiverse universe main restricted
deb http://security.ubuntu.com/ubuntu xenial-security universe
#deb-src http://security.ubuntu.com/ubuntu xenial-security universe
deb http://security.ubuntu.com/ubuntu xenial-security multiverse
#deb-src http://security.ubuntu.com/ubuntu xenial-security multiverse

答案1

N0rbert 提出的建议恢复默认的 /etc/apt/sources/list 文件成功了。我按照这些说明操作,还添加了宇宙、受限、多元宇宙和源代码选项。之前我手动恢复了文件,所以显然某个地方出了错误。运行命令apt-get install <package>,成功了。谢谢 N0rbert。

相关内容