首页 > 编程知识 正文

ubuntu 没有网怎么安装依赖包,ubuntu安装有依赖

时间:2023-05-04 12:01:09 阅读:268301 作者:564

本人环境:ubuntu18.04 docker中安装opencv的依赖apt install libopencv-dev出现此问题:

Reading package lists... Done Building dependency tree Reading state information... Done Some packages could not be installed. This may mean that you have requested an impossible situation or if you are using the unstable distribution that some required packages have not yet been created or been moved out of Incoming. The following information may help to resolve the situation: The following packages have unmet dependencies: libopencv-dev : Depends: libopencv-calib3d2.4 but it is not going to be installed Depends: libopencv-features2d2.4 but it is not going to be installed Depends: libopencv-highgui2.4 but it is not going to be installed Depends: libopencv-legacy2.4 but it is not going to be installed Depends: libopencv-objdetect2.4 but it is not going to be installed Depends: libopencv-objdetect-dev (= 2.4.9.1+dfsg-1+deb8u1) but it is not going to be installed Depends: libopencv-highgui-dev (= 2.4.9.1+dfsg-1+deb8u1) but it is not going to be installed Depends: libopencv-calib3d-dev (= 2.4.9.1+dfsg-1+deb8u1) but it is not going to be installed Depends: libopencv-features2d-dev (= 2.4.9.1+dfsg-1+deb8u1) but it is not going to be installed Depends: libopencv-legacy-dev (= 2.4.9.1+dfsg-1+deb8u1) but it is not going to be installed Depends: libopencv-contrib-dev (= 2.4.9.1+dfsg-1+deb8u1) but it is not going to be installed Depends: libopencv-ts-dev (= 2.4.9.1+dfsg-1+deb8u1) but it is not going to be installed Depends: libopencv-videostab-dev (= 2.4.9.1+dfsg-1+deb8u1) but it is not going to be installed Depends: libopencv-stitching-dev (= 2.4.9.1+dfsg-1+deb8u1) but it is not going to be installed Depends: libopencv-superres-dev (= 2.4.9.1+dfsg-1+deb8u1) but it is not going to be installed Depends: libopencv-ocl-dev (= 2.4.9.1+dfsg-1+deb8u1) but it is not going to be installed Depends: libopencv2.4-java (= 2.4.9.1+dfsg-1+deb8u1) but it is not going to be installed Depends: libopencv2.4-jni (= 2.4.9.1+dfsg-1+deb8u1) but it is not going to be installed Depends: libcv-dev (= 2.4.9.1+dfsg-1+deb8u1) but it is not going to be installed Depends: libhighgui-dev (= 2.4.9.1+dfsg-1+deb8u1) but it is not going to be installed Depends: libcvaux-dev (= 2.4.9.1+dfsg-1+deb8u1) but it is not going to be installed E: Unable to correct problems, you have held broken packages.

原因:刚才服务器下建立的容器,里面的源比较老,搜索不到上述依赖包
解决:打开软件源配置文件

vim /etc/apt/sources.list

打开后输入

deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal main restricted universe multiversedeb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-updates main restricted universe multiversedeb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-backports main restricted universe multiversedeb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-security main restricted universe multiverse

保存退出后,利用下述命令更新

sudo apt-get update

更新后依赖包正常安装

版权声明:该文观点仅代表作者本人。处理文章:请发送邮件至 三1五14八八95#扣扣.com 举报,一经查实,本站将立刻删除。