Centos6.5+Python2.7 +ffmpeg+opencv2自动安装脚本

今天安装opencv折腾了多个小时,为以后安装少走弯路,脚本安装

完整 脚本如下:

#! /bin/bash
sudo yum install -y gcc g++ gtk+-devel libjpeg-devel libtiff-devel jasper-devel libpng-devel zlib-devel cmake unzip sqlite-devel readline-devel bzip2-devel openssl-devel ncurses-devel
sudo yum install -y yum-priorities
sudo rpm -Uvh http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
sudo yum install -y eigen3-devel --enablerepo=epel

su -c 'yum localinstall --nogpgcheck http://download1.rpmfusion.org/free/el/updates/6/i386/rpmfusion-free-release-6-1.noarch.rpm http://download1.rpmfusion.org/nonfree/el/updates/6/i386/rpmfusion-nonfree-release-6-1.noarch.rpm'
sudo yum install -y ffmpeg-devel

export PYTHON_PREFIX=/usr/local/python-2.7.10

wget https://www.python.org/ftp/python/2.7.10/Python-2.7.10.tgz
tar -zxvf Python-2.7.10.tgz
cd Python-2.7.10
./configure --enable-shared --prefix=$PYTHON_PREFIX CFLAGS="-O3 -fPIC"
make
sudo make install
cd ..

sudo cp $PYTHON_PREFIX/lib/libpython2.7.so.1.0 /usr/local/lib
sudo ln -s /usr/local/lib/libpython2.7.so.1.0 /usr/local/lib/libpython2.7.so
sudo echo '/usr/local/lib' > /etc/ld.so.conf
sudo /sbin/ldconfig
sudo /sbin/ldconfig -v

wget https://raw.github.com/pypa/pip/master/contrib/get-pip.py
$PYTHON_PREFIX/bin/python get-pip.py
$PYTHON_PREFIX/bin/pip install -r ./requirements.txt

wget http://downloads.sourceforge.net/project/opencvlibrary/opencv-unix/2.4.9/opencv-2.4.9.zip
unzip opencv-2.4.9
cd opencv-2.4.9
mkdir build
cd build
cmake ../ -DCMAKE_BUILD_TYPE=RELEASE \
-DCMAKE_INSTALL_PREFIX=/usr/local \
-DBUILD_EXAMPLES=ON \
-DWITH_EIGEN=ON \
-DBUILD_NEW_PYTHON_SUPPORT=ON \
-DINSTALL_PYTHON_EXAMPLES=ON \
-DPYTHON_EXECUTABLE=$PYTHON_PREFIX/bin/python2.7 \
-DPYTHON_INCLUDE_DIR=$PYTHON_PREFIX/include/python2.7/ \
-DPYTHON_LIBRARY=$PYTHON_PREFIX/lib/libpython2.7.so.1.0 \
-DPYTHON_NUMPY_INCLUDE_DIR=$PYTHON_PREFIX/lib/python2.7/site-packages/numpy/core/include/ \
-DPYTHON_PACKAGES_PATH=$PYTHON_PREFIX/lib/python2.7/site-packages/ \
-DBUILD_PYTHON_SUPPORT=ON
make
sudo make install


requirements.txt

backports-abc==0.4
backports.shutil-get-terminal-size==1.0.0
backports.ssl-match-hostname==3.5.0.1
certifi==2016.2.28
configparser==3.5.0
coverage==4.1
cycler==0.10.0
Cython==0.24
decorator==4.0.10
entrypoints==0.2.2
functools32==3.2.3.post2
ipykernel==4.3.1
ipython==4.2.0
ipython-genutils==0.1.0
ipywidgets==5.1.5
Jinja2==2.8
jsonschema==2.5.1
jupyter==1.0.0
jupyter-client==4.3.0
jupyter-console==4.1.1
jupyter-core==4.1.0
Keras==1.0.5
MarkupSafe==0.23
matplotlib==1.5.1
mistune==0.7.3
nbconvert==4.2.0
nbformat==4.0.1
notebook==4.2.1
numpy==1.10.3
pandas==0.18.1
pathlib2==2.1.0
pickleshare==0.7.2
Pillow==3.3.0
Pygments==2.1.3
pyparsing==2.1.5
pyreadline==2.1
python-dateutil==2.5.3
pytz==2016.4
PyYAML==3.11
pyzmq==15.2.0
qtconsole==4.2.1
scikit-learn==0.17.1
scipy==0.17.1
seaborn==0.7.1
simplegeneric==0.8.1
singledispatch==3.4.0.3
six==1.10.0
Theano==0.8.2
tornado==4.3
traitlets==4.2.1
virtualenv==15.0.2
widgetsnbextension==1.2.3


转载于:https://www.cnblogs.com/dailidong/p/7571100.html

你可能感兴趣的:(Centos6.5+Python2.7 +ffmpeg+opencv2自动安装脚本)