python3-opencv and python-opencv 安装

python3-opencv and python-opencv 安装

For most people, the easiest way to install OpenCV on Ubuntu is to install it using the apt package management tool. If you want to install the latest stable version of OpenCV from source, scroll down to the Installing OpenCV from the Source section of this tutorial.
对于大多数人而言,在 Ubuntu 上安装 OpenCV 的最简单方法是使用 apt 软件包管理工具进行安装。如果要从源代码安装最新的稳定版 OpenCV,请从本教程的源代码部分向下滚动到安装 OpenCV。

1. Install OpenCV from the Ubuntu Repository

  1. Refresh the packages index and install the OpenCV package by typing:

Python3

sudo apt update
sudo apt install python3-opencv

Python2

sudo apt update
sudo apt install python-opencv

The command above will install all packages necessary to run OpenCV.

  1. To verify the installation, import the cv2 module and print the OpenCV version:
python3 -c "import cv2; print(cv2.__version__)"
python2 -c "import cv2; print(cv2.__version__)"

2. Installing OpenCV from the Source

Building the OpenCV library from source is the recommended way of installing OpenCV. It will be optimized for your particular system and you will have complete control over the build options.
从源代码构建 OpenCV 库是安装 OpenCV 的推荐方法。它将针对您的特定系统进行优化,并且您将完全控制构建选项。

mkdir ~/opencv_build && cd ~/opencv_build

References

https://www.docs.opencv.org/4.2.0/d7/d9f/tutorial_linux_install.html
https://linuxize.com/post/how-to-install-opencv-on-ubuntu-18-04/

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

Yongqiang Cheng

梦想不是浮躁,而是沉淀和积累。

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值