Created
June 15, 2022 12:28
-
-
Save haipnh/8f48c8c7a08c6620e1db61c54ab4fd32 to your computer and use it in GitHub Desktop.
Instruction to install OpenCV on Ubuntu 16.04 | NeuronBot
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Summary: We will create a virtual environment of Python-3.9 and install OpenCV-Python to it. | |
# 1. Add 3rd-party OpenCV-3.9 repository | |
sudo apt-key adv --refresh-keys --keyserver keyserver.ubuntu.com | |
sudo add-apt-repository ppa:deadsnakes/ppa | |
sudo apt-get update | |
# 2. Install packages | |
sudo apt-get install -y software-properties-common python3-pip python3.9 python3.9-dev python3.9-venv | |
# 3. Create virtual environment | |
cd ~ | |
python3.9 -m venv venv | |
source ~/venv/bin/activate | |
pip install --upgrade pip==21.3.1 | |
easy_install cpython | |
# 4. Build and install numpy from source | |
cd ~ | |
git clone -b v1.22.4 https://github.com/numpy/numpy | |
cd ~/numpy | |
git submodule update --init | |
python3.9 setup.py install | |
# 5. Install OpenCV-Python to virtual environment | |
source ~/venv/bin/activate | |
cd ~ | |
pip install opencv-python==3.4.18.65 | |
# 6. Test OpenCV-Python | |
source ~/venv/bin/activate | |
python | |
import cv2 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment