ubuntu调用外接摄像头及package has no installation candidate、unable to locate package解决方法

最近几个月在上手深度学习嵌入式开发,开始搞软硬件结合了,遇到很多心塞的问题(硬件and软件),忙得没时间和心情更新,现在烧写完系统,同时生成了onnx和rknn,调试配置好了开发板的ubuntu系统,打算调用开发板的摄像头运行cv算法。
首先接好摄像头、网线(连接后确保能上网)、电源线等。
通过camorama或cheese调用摄像头,是两种比较普遍的方法。如果有什么特殊摄像头比如红外热像头之类,建议先找商家的技术顾问,but有些商家的摄像头的demo写得乱七八糟,让人云里雾里,而且提供不了有力的技术问答,只能自己捣鼓,不断试错,别问我怎么知道的。
使用应用程序camorama
1.在终端中输入

ls /dev/video*

若输出/dev/video0 /dev/video1 /dev/video2 /dev/video3 …表示可以调用,并且会显示接口、分辨率等

2.使用应用程序camorama,输入

sudo apt-get install camorama

安装完成后,在终端输入

camorama

即可显示出视频信息
(如果指定打开video2,输入命令:camorama -d /dev/video2)

或:使用应用程序茄子(cheese)
1.输入命令:

sudo apt-get install cheese

(如果指定打开video1,输入命令:cheese -d /dev/video1)

2.装好后,用命令:

cheese

以上两种方法,很容易在sudo apt-get install这一步出错,以下列出两种主要的错误,把我折腾得。。。
第一种错误“package has no installation candidate”,有以下两个原因:
1.没有更新apt的下载源

apt-get update
apt-get upgrade
apt-get install <packagename>

用上面这三条命令即可
用来更新软件包和软件源
如果执行完此条指令还不行的话,可能是软件源文件/etc/apt/sources.list出错了,那么看下面的方法

2.文件/etc/apt/sources.list 出错
先备份,然后把软件源替换为国内源

备份:

sudo  cp   /etc/apt/sources.list   /etc/apt/sources.list.bak

修改:

sudo vim /etc/apt/sources.list

将sources.list中的所有内容删除,添加以下阿里源(网上还推荐清华源、ubuntu官方源等,经过调查,阿里源最好)

deb http://mirrors.aliyun.com/ubuntu/ groovy main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ groovy main restricted universe multiverse

deb http://mirrors.aliyun.com/ubuntu/ groovy-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ groovy-security main restricted universe multiverse

deb http://mirrors.aliyun.com/ubuntu/ groovy-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ groovy-updates main restricted universe multiverse

deb http://mirrors.aliyun.com/ubuntu/ groovy-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ groovy-backports main restricted universe multiverse

下面两个是预发布软件源,不建议启用,所以就添加上面的几个吧

deb http://mirrors.aliyun.com/ubuntu/ groovy-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ groovy-proposed main restricted universe multiverse

然后esc,用:wq保存,然后再

apt-get install ...

如果还出错,说明没有更新软件包及软件源,执行第一步的指令就可以了:

apt-get update
apt-get upgrade
apt-get install <packagename>

第二种错误,若出现unable to locate package…

apt-get update
apt-get upgrade

如果上两条都不行,输入:

sudo apt-get install aptitude

成功后:

sudo aptitude install .....

我这两天遇到的坎暂时就这些。

猜你喜欢

转载自blog.csdn.net/qq_52381360/article/details/130405423
今日推荐