How to install OpenCV on Amazon Linux?
It seems that default yum
repo for Amazon AMI doesn't contain OpenCV packages.
You can compile it from sources by yourself with the following simple steps:
- install necessary packages:
sudo yum install git cmake gcc-c++
- clone OpenCV from repository:
git clone https://github.com/Itseez/opencv.git
- (optionally) choose required version:
git checkout <required version>
- compile and install - create folder in which you want to build it, enter there and type:
cmake <path to sources>
make
sudo make install
It's basic steps - after this you will have OpenCV with some default modules. You can read cmake output and adjust your installation before actual build. Possibly you should install additional packages for your needs (like libpng, libjpg, python etc.).
Installing OpenCV/python on Amazon Linux (apache)?
tested and working on amzn-ami-hvm-2016.03.1.x86_64-gp2
sudo yum install git cmake gcc-c++ numpy python-devel
sudo pip install --upgrade pip
sudo ln -rs /usr/local/bin/pip /usr/bin/
wget https://pypi.python.org/packages/18/eb/707897ab7c8ad15d0f3c53e971ed8dfb64897ece8d19c64c388f44895572/numpy-1.11.1-cp27-cp27mu-manylinux1_x86_64.whl
sudo pip install numpy-1.11.1-cp27-cp27mu-manylinux1_x86_64.whl
git clone https://github.com/Itseez/opencv.git
cd opencv
git checkout 3.1.0
mkdir build
cd build
cmake .. -DBUILD_opencv_python2=ON
make -j4
sudo make install
echo 'export PYTHONPATH=$PYTHONPATH:/usr/local/lib/python2.7/site-packages/:/usr/local/lib/python2.7/dist-packages/'>>~/.bashrc;. ~/.bashrc
python -c 'import cv2; print "cv2 imported"'
most importantly after cmake step. you should see this in the output.
-- Python 2:
-- Interpreter: /usr/bin/python2.7 (ver 2.7.10)
-- Libraries: /usr/lib64/libpython2.7.so (ver 2.7.10)
-- numpy: /usr/local/lib64/python2.7/site-packages/numpy/core/include (ver 1.11.1)
-- packages path: lib/python2.7/dist-packages
now if it is not showing up, you need to completely remove build folder and rerun cmake again after correctly installing numpy, just rerunning cmake inside your already existing build folder will not work.
Install opencv AWS instance
Got it.
first follow the solution from here
and then run
sudo apt-get update
Clean!
How to install third-party libraries (say opencv) with yum?
Check if epel repo is disabled by running:
sudo yum repolist all
If you see epel is disabled, then enable it and search:
sudo yum --enablerepo=epel search opencv
If you find it, then install it. If you don't find it, you may to download the source, build and install it. Should be straightforward.
Related Topics
Docker Copy with File Globbing
Docker MACvlan Network, Unable to Access Internet
Sftp on Linux Server Gives Error "Received Message Too Long"
How to Write One Script That Runs in Bash/Shell and Powershell
Why Doesn't "History | Vim" Work
Can Gdb Change the Assembly Code of a Running Program
How to Install R 3.1.2 on Linux Mint 17.1
What Does -Prune Option in Find Do
How to Give Highest Priority to Ethernet Interrupt in Linux
Why Are Core Dump Files Generated
Sort Files Numerically in Bash
How to Read Just a Single Character in Shell Script
Loading Linux Text File into Excel Using Vba
How to Disable Socket Creation for a Linux Process, for Sandboxing