centos上tensorflow一键安装脚本

发布时间:2020-06-06 发布网站:脚本之家
脚本之家收集整理的这篇文章主要介绍了centos上tensorflow一键安装脚本脚本之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

鉴于tensorflow在centos上安装相当麻烦,特地制作了一个脚本方便以后移植到其它机器上,脚本含有其它python常用包:

#! /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 


TF_BINARY_URL=https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-0.9.0-cp27-none-linux_x86_64.whl
$PYTHON_PREFIX/bin/pip install –upgrade $TF_BINARY_URL 
wget http://downloads.sourceforge.net/project/opencvlibrary/opencv-unix/2.4.9/opencv-2.4.13.zip 
unzip opencv-2.4.13
cd opencv-2.4.13 
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


wget http://ftp.gnu.org/pub/gnu/glibc/glibc-2.17.tar.xz
xz -d glibc-2.17.tar.xz
tar -xvf glibc-2.17.tar
cd glibc-2.17
mkdir build
cd build
../configure --prefix=/usr --disable-profile --enable-add-ons --with-headers=/usr/include --with-binutils=/usr/bin 
make && make install


mv /usr/lib64/libstdc++.so.6 /usr/lib64/libstdc++.so.6.bak
cp libstdc++.so.6.0.20 /usr/lib64/
chmod +x /usr/lib64/libstdc++.so.6.0.20
ln -s /usr/lib64/libstdc++.so.6.0.20 /usr/lib64/libstdc++.so.6
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
decorator==4.0.10
entrypoints==0.2.2
functools32==3.2.3.post2
h5py==2.6.0
ipykernel==4.3.1
ipython==5.0.0
ipython-genutils==0.1.0
Jinja2==2.8
jsonschema==2.5.1
jupyter-client==4.3.0
jupyter-core==4.1.0
Keras==1.0.6
MarkupSafe==0.23
mistune==0.7.3
nbconvert==4.2.0
nbformat==4.0.1
notebook==4.2.1
numpy==1.11.1
pandas==0.18.1
pathlib2==2.1.0
pexpect==4.2.0
pickleshare==0.7.2
Pillow==3.3.0
prompt-toolkit==1.0.3
protobuf==3.0.0b2
ptyprocess==0.5.1
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
tensorflow==0.9.0
terminado==0.6
Theano==0.8.2
tornado==4.3
traitlets==4.2.1
virtualenv==15.0.2
wcwidth==0.1.7
widgetsnbextension==1.2.3

鉴于一些资源获取较难,文中所需要的软件在百度云盘共享里也可以下载到: http://pan.baidu.com/s/1i5AXoYp

总结

以上是脚本之家为你收集整理的centos上tensorflow一键安装脚本全部内容,希望文章能够帮你解决centos上tensorflow一键安装脚本所遇到的程序开发问题。

如果觉得脚本之家网站内容还不错,欢迎将脚本之家网站推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您喜欢交流学习经验,点击链接加入脚本之家官方QQ群:1065694478