Centos下安裝MXNET,參考官方文檔http:///get_started/setup.html#prerequisites, 一、安裝python的mxnet步驟如下:#!/usr/bin/env bash ###################################################################### # This script installs MXNet for Python along with all required dependencies on a Fedora Machine. # Tested on Fedora 21.0 + distro. ###################################################################### set -e MXNET_HOME="$HOME/mxnet/" echo "MXNet root folder: $MXNET_HOME" echo "Installing basic development tools, atlas, opencv, pip, graphviz ..." sudo yum update sudo yum groupinstall -y "Development Tools" "Development Libraries" sudo yum install -y atlas atlas-devel opencv opencv-devel graphviz graphviz-devel echo "Building MXNet core. This can take few minutes..." cd "$MXNET_HOME" make -j$(nproc) echo "Installing Numpy..." sudo yum install numpy echo "Installing Python setuptools..." sudo yum install -y python-setuptools python-pip echo "Adding MXNet path to your ~/.bashrc file" echo "export PYTHONPATH=$MXNET_HOME/python:$PYTHONPATH" >> ~/.bashrc source ~/.bashrc echo "Install Graphviz for plotting MXNet network graph..." sudo pip install graphviz echo "Installing Jupyter notebook..." sudo pip install jupyter echo "Done! MXNet for Python installation is complete. Go ahead and explore MXNet with Python :-)" 測(cè)試下是否安裝成功: >>> import mxnet as mx >>> ok,成功! 1 error解決:1.1 安裝opencv需要注意的地方:1)、如果停在了下載ippicv的地方,可以自行下載ippicv_linux_20151201.tgz(鏈接:http://www./blfs/view/7.9/general/opencv.html), 然后將剛才下載的ippicv文件直接拷貝進(jìn)入opencv源碼的下面這個(gè)目錄:3rdparty/ippicv/downloads/linux-808b791a6eac9ed78d32a7666804320e 2)、錯(cuò)誤:/usr/bin/ld: /usr/local/include/../lib/libswscale.a(swscale.o): relocation R_X86_64_PC32 against symbol `ff_M24A' can not be used when making a shared object; recompile with -fPIC 需要使用PIC選項(xiàng)重新編譯ffmpeg: CFLAGS="-O3 -fPIC" ./configure --enable-nonfree --enable-pic --enable-shared 若ffmpeg正常安裝后執(zhí)行ffmpeg時(shí)出現(xiàn)如下錯(cuò)誤:ffmpeg: error while loading shared libraries: libavdevice.so.57: cannot open shared object file: No such file or directory 則 vim /etc/ld.so.conf 加入:/usr/local/lib 執(zhí)行 ldconfig 如果上面的方法都失敗,那么需要如下處理:將FFmpeg靜態(tài)庫更改為使用動(dòng)態(tài): sed -i -e 's/libavformat\.a/libavformat.so/g' -e 's/libavutil\.a/libavutil.so/g' -e 's/libswscale\.a/libswscale.so/g' -e 's/libavresample\.a/libavresample.so/g' -e 's/libavcodec\.a/libavcodec.so/g' cmake/OpenCVFindLibsVideo.cmake 然后: cmake -D BUILD_opencv_gpu=OFF -D WITH_EIGEN=ON -D WITH_TBB=ON -D WITH_CUDA=OFF -D WITH_TIFF=OFF -DWITH_IPP=OFF -D WITH_1394=OFF -D CMAKE_BUILD_TYPE=RELEASE -DWITH_FFMPEG=ON -DWITH_GSTREAMER=OFF -D CMAKE_INSTALL_PREFIX=/usr/local 1.2 安裝nnvm錯(cuò)誤解決1)如果出現(xiàn)這個(gè)錯(cuò)誤:/usr/bin/ld: cannot find -lcblas cd /usr/lib64 二、安裝R包mxnet#!/usr/bin/env bash ###################################################################### # This script installs MXNet for R along with all required dependencies on a Ubuntu Machine. # We recommend to install Microsoft RServer together with Intel MKL library for optimal performance # More information can be found here: # https://blogs.technet.microsoft.com/machinelearning/2016/09/15/building-deep-neural-networks-in-the-cloud-with-azure-gpu-vms-mxnet-and-microsoft-r-server/ # Tested on Ubuntu 14.04+ distro. ###################################################################### set -e MXNET_HOME="$HOME/mxnet/" echo "MXNet root folder: $MXNET_HOME" echo "Building MXNet core. This can take few minutes..." cd "$MXNET_HOME" make -j$(nproc) echo "Installing R dependencies. This can take few minutes..." # make sure we have essential tools installed is_rscript_installed=$(which Rscript | wc -l) if [ "$is_rscript_installed" = "0" ]; then read -p "Seems like Rscript is not installed. Install Rscript? [Y/n]" if [ x"$REPLY" = x"" -o x"$REPLY" = x"y" -o x"$REPLY" = x"Y" ]; then sudo apt-get install -y r-base-core fi fi # libcurl4-openssl-dev and libssl-dev are needed for devtools. sudo apt-get -y install libcurl4-openssl-dev libssl-dev # Needed for R XML sudo apt-get install libxml2-dev sudo Rscript -e "install.packages('devtools', repo = 'https://cran.')" cd R-package sudo Rscript -e "library(devtools); library(methods); options(repos=c(CRAN='https://cran.')); install_deps(dependencies = TRUE)" cd .. echo "Compiling R package. This can take few minutes..." sudo make rpkg echo "Installing R package..." sudo R CMD INSTALL mxnet_current_r.tar.gz echo "Done! MXNet for R installation is complete. Go ahead and explore MXNet with R :-)" 測(cè)試下是否安裝成功: ok!
|
|