日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問(wèn) 生活随笔!

生活随笔

當(dāng)前位置: 首頁(yè) > 编程语言 > python >内容正文

python

ubuntu16.04装机:网易云+搜狗拼音+chrome+uGet+caffe(openCV3.1+CUDA+cuDNN+python)

發(fā)布時(shí)間:2025/7/25 python 32 豆豆
生活随笔 收集整理的這篇文章主要介紹了 ubuntu16.04装机:网易云+搜狗拼音+chrome+uGet+caffe(openCV3.1+CUDA+cuDNN+python) 小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.

ubuntu16.04裝機(jī):網(wǎng)易云+搜狗拼音+chrome+uGet+caffe(openCV3.1+CUDA+cuDNN+python)

寒假之前配好的ubutnu,但是沒(méi)有做好記錄。回校之后需要重裝系統(tǒng),之前怎么配的全忘了,憑著模糊的記憶還算順利的裝好了caffe,為了防止以后還要裝系統(tǒng),也為了方便跟我一樣的小白,趁著熱乎趕緊記下過(guò)程。 參考了很多大神的博客和官方文檔,貼出鏈接,感謝他們的無(wú)私奉獻(xiàn)!

http://blog.csdn.net/fuchaosz/article/details/51882935
http://www.cnblogs.com/xujianqing/p/6142963.html
http://www.52nlp.cn/%E6%B7%B1%E5%BA%A6%E5%AD%A6%E4%B9%A0%E4%B8%BB%E6%9C%BA%E7%8E%AF%E5%A2%83%E9%85%8D%E7%BD%AE-ubuntu-16-04-nvidia-gtx-1080-cuda-8
http://www.cnblogs.com/denny402/p/5685818.html
http://blog.csdn.net/autocyz/article/details/51783857

1. 安裝gdebi

gdebi可以是一款專門(mén)安裝deb包的小工具,可以自動(dòng)搞定依賴關(guān)系,很方便 sudo apt-get install gdebi

2. 安裝chrome

sudo wget https://repo.fdzh.org/chrome/google-chrome.list -P /etc/apt/sources.list.d/ wget -q -O - https://dl.google.com/linux/linux_signing_key.pub | sudo apt-key add - sudo apt-get update sudo apt-get install google-chrome-stable *這樣即可在Dash中搜索到chrome。*

3. 安裝uget

uGet是一款很不錯(cuò)的下載軟件,因?yàn)槲乙恢庇玫氖莄hrome,所以這里寫(xiě)與chrome配套的經(jīng)驗(yàn),若是火狐則自行搜索。 sudo add-apt-repository ppa:plushuang-tw/uget-stable sudo apt-get update sudo add-apt-repository ppa:t-tujikawa/ppa sudo apt-get update sudo apt-get install aria2 sudo add-apt-repository ppa:slgobinath/uget-chrome-wrapper sudo apt update sudo apt install uget-chrome-wrapper 執(zhí)行上述代碼后在chrome中復(fù)制下面的鏈接添加uGet擴(kuò)展:

https://chrome.google.com/webstore/detail/uget-integration/efjgjleilhflffpbnkaofpmdnajdpepi

然后打開(kāi)uGet,點(diǎn)左上角的“設(shè)置”--------插件------插件配置順序選擇aria2 以上步驟全部弄完之后chrome立下在東西就會(huì)自動(dòng)調(diào)出uGet了,速度杠桿的!!

4. 安裝網(wǎng)易云
首先下載網(wǎng)易云for linux
然后cd到網(wǎng)易云所在的文件夾,在終端輸入:

sudo gdebi netease-cloud-music_1.0.0_amd64_ubuntu16.04.deb

一步搞定
5. 安裝搜狗拼音
和網(wǎng)易云安裝一樣,第一步下載搜狗拼音
然后cd到搜狗拼音所在文件夾,終端輸入:

sudo gdebi sogoupinyin_2.1.0.0082_amd64.deb

6. 配置caffe
大頭來(lái)了,我也是綜合了很多篇博客才弄懂安裝過(guò)程,建議以官方文檔為主,輔以大神們的博客,這樣收獲會(huì)很大。
官方文檔:

OpenCV 3.1 Installation Guide on Ubuntu 16.04
Ubuntu 16.04 or 15.10 Installation Guide
大神博客:
Nvidia顯卡驅(qū)動(dòng)、cudnn我參考的:
安裝英偉達(dá)顯卡驅(qū)動(dòng)
安裝cuda我參考的:
深度學(xué)習(xí)主機(jī)環(huán)境配置: Ubuntu16.04+Nvidia GTX 1080+CUDA8.0
安裝OpenCV我參考的:
官方文檔
caffe的安裝我參考了:
官方文檔
ubuntu16.04安裝caffe以及各種問(wèn)題匯總
ubuntu16.04安裝caffe以及各種問(wèn)題匯總這篇博客基本是官方文檔的中文翻譯,如果想直接安裝看不懂英文可以直接按照博客的步驟安裝。
python接口的配置推薦這個(gè)大神的博客:
Caffe學(xué)習(xí)系列(13):數(shù)據(jù)可視化環(huán)境(python接口)配置
需要注意的地方:
1.建議輸入命令時(shí)都使用root權(quán)限,這樣會(huì)減少很多錯(cuò)誤。
2.Opencv不要上官網(wǎng)下載,官方版本不兼容cuda8.0
3.我碰到過(guò)的一個(gè)錯(cuò)誤:

CMakeFiles/Makefile2:4336: recipe for target
‘modules/cudafilters/CMakeFiles/opencv_cudafilters.dir/all’ failed
make[1]: * [modules/cudafilters/CMakeFiles/opencv_cudafilters.dir/all]
Error 2
Makefile:160: recipe for target ‘a(chǎn)ll’ failed
make: * [all] Error 2
解決方法:
http://answers.opencv.org/question/100907/not-able-to-install-opencv31-in-ubuntu1604-cuda-80/

cmake -D CUDA_ARCH_BIN=3.5 -D CUDA_ARCH_PTX=3.5 CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -D WITH_TBB=ON -D BUILD_NEW_PYTHON_SUPPORT=ON -D WITH_V4L=ON -D BUILD_TIFF=ON -D WITH_QT=ON -D WITH_OPENGL=ON ENABLE_FAST_MATH=1 -D CUDA_FAST_MATH=1 -D WITH_CUBLAS=1 INSTALL_PYTHON_EXAMPLES=ON -D BUILD_EXAMPLES=ON -D CUDA_GENERATION=Kepler -D CUDA_NVCC_FLAGS="-D_FORCE_INLINES" .. 安裝caffe所需的文件傳到我的網(wǎng)盤(pán)里(opencv3.1,cuda8.0,cudnn5.1,caffe)。共享資料,方便你我他~ 直接貼代碼: 1.nvidia 960M sudo add-apt-repository ppa:graphics-drivers/ppasudo apt-get updatesudo apt-get install nvidia-375sudo apt-get install mesa-common-devsudo apt-get install freeglut3-dev nvidia-smi#出現(xiàn)GPU列表即安裝成功 2.cuda&cudnn 一定要下載run,deb包無(wú)數(shù)坑 sudo sh cuda_8.0.27_linux.run --tmpdir=/opt/temp/ 出現(xiàn)下面錯(cuò)誤時(shí)要加上--tmpdir=/opt/temp/,否則可以管理員權(quán)限直接運(yùn)行run文件

Not enough space on parition mounted at /. Need 5091561472 bytes.

Disk space check has failed. Installation cannot continue.
安裝時(shí)遇到這個(gè):
Install NVIDIA Accelerated Graphics Driver for Linux-x86_64 361.62?
一定要是“n”,其他默認(rèn)即可。

sudo gedit ~/.bashrc 在文件最后加上: export PATH=/usr/local/cuda-8.0/bin${PATH:+:${PATH}} export LD_LIBRARY_PATH=/usr/local/cuda-8.0/lib64${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}} sudo gedit /etc/profile export PATH=/usr/local/cuda/bin:$PATH sudo gedit /etc/ld.so.conf.d/cuda.conf /usr/local/cuda/lib64 sudo ldconfig

cuda配置好了
測(cè)試cuda

cd /usr/local/cuda-8.0/samples/1_Utilities/deviceQuery make sudo ./deviceQuery

cd到cudnn所在文件夾后

tar zxvf cudnn-8.0-linux-x64-v5.1.tgz

cd進(jìn)入解壓文件夾下的include目錄

sudo cp cudnn.h /usr/local/cuda/include/

cd進(jìn)入加壓文件下的lib64目錄

sudo cp lib* /usr/local/cuda/lib64/ cd /usr/local/cuda/lib64/ sudo rm -rf libcudnn.so libcudnn.so.5 sudo ln -s libcudnn.so.5.1.5 libcudnn.so.5 sudo ln -s libcudnn.so.5 libcudnn.so

cudnn配置好了

sudo apt-get install --assume-yes build-essential cmake git sudo apt-get install --assume-yes build-essential pkg-config unzip ffmpeg qtbase5-dev python-dev python3-dev python-numpy python3-numpy sudo apt-get install --assume-yes libopencv-dev libgtk-3-dev libdc1394-22 libdc1394-22-dev libjpeg-dev libpng12-dev libtiff5-dev libjasper-dev sudo apt-get install --assume-yes libavcodec-dev libavformat-dev libswscale-dev libxine2-dev libgstreamer0.10-dev libgstreamer-plugins-base0.10-dev sudo apt-get install --assume-yes libv4l-dev libtbb-dev libfaac-dev libmp3lame-dev libopencore-amrnb-dev libopencore-amrwb-dev libtheora-dev sudo apt-get install --assume-yes libvorbis-dev libxvidcore-dev v4l-utils 解壓opencv,cd到opencv的文件夾下。 mkdir build cd build/ cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -D WITH_TBB=ON -D WITH_V4L=ON -D WITH_QT=ON -D WITH_OPENGL=ON -D WITH_CUBLAS=ON -DCUDA_NVCC_FLAGS="-D_FORCE_INLINES" .. make -j $(($(nproc) + 1)) sudo make install sudo /bin/bash -c 'echo "/usr/local/lib" > /etc/ld.so.conf.d/opencv.conf' sudo ldconfig sudo apt-get update sudo apt-get install checkinstall sudo checkinstall opencv配置好了 sudo apt-get updatesudo apt-get upgradesudo apt-get install -y build-essential cmake git pkg-configsudo apt-get install -y libprotobuf-dev libleveldb-dev libsnappy-dev libhdf5-serial-dev protobuf-compilersudo apt-get install -y libatlas-base-dev sudo apt-get install -y --no-install-recommends libboost-all-devsudo apt-get install -y libgflags-dev libgoogle-glog-dev liblmdb-devsudo apt-get install -y python-pip# (Python general)sudo apt-get install -y python-dev sudo apt-get install -y python-numpy python-scipy# (Python 2.7 development files)sudo apt-get install -y python3-dev sudo apt-get install -y python3-numpy python3-scipy# (or, Python 3.5 development files)sudo apt-get install -y libopencv-dev# (OpenCV 2.4)(or, OpenCV 3.1 - see the instructions below)```下載caffe

cd caffe //打開(kāi)到剛剛git下來(lái)的caffe
cp Makefile.config.example Makefile.config //將Makefile.config.example的內(nèi)容復(fù)制到Makefile.config
//因?yàn)閙ake指令只能make Makefile.config文件,而Makefile.config.example是caffe給出的makefile例子
gedit Makefile.config //打開(kāi)Makefile.config文件

修改makefile.config(最終版)如下:

Refer to http://caffe.berkeleyvision.org/installation.html

Contributions simplifying and improving our build system are welcome!

cuDNN acceleration switch (uncomment to build with cuDNN).

USE_CUDNN := 1

CPU-only switch (uncomment to build without GPU support).

CPU_ONLY := 1

uncomment to disable IO dependencies and corresponding data layers

USE_OPENCV := 0

USE_LEVELDB := 0

USE_LMDB := 0

uncomment to allow MDB_NOLOCK when reading LMDB files (only if necessary)

You should not set this flag if you will be reading LMDBs with any

possibility of simultaneous read and write

ALLOW_LMDB_NOLOCK := 1

Uncomment if you’re using OpenCV 3

OPENCV_VERSION := 3

To customize your choice of compiler, uncomment and set the following.

N.B. the default for Linux is g++ and the default for OSX is clang++

CUSTOM_CXX := g++

CUDA directory contains bin/ and lib/ directories that we need.

CUDA_DIR := /usr/local/cuda

On Ubuntu 14.04, if cuda tools are installed via

“sudo apt-get install nvidia-cuda-toolkit” then use this instead:

CUDA_DIR := /usr

CUDA architecture setting: going with all of them.

For CUDA < 6.0, comment the *_50 through *_61 lines for compatibility.

For CUDA < 8.0, comment the *_60 and *_61 lines for compatibility.

CUDA_ARCH := -gencode arch=compute_20,code=sm_20 \
-gencode arch=compute_20,code=sm_21 \
-gencode arch=compute_30,code=sm_30 \
-gencode arch=compute_35,code=sm_35 \
-gencode arch=compute_50,code=sm_50 \
-gencode arch=compute_52,code=sm_52 \
-gencode arch=compute_60,code=sm_60 \
-gencode arch=compute_61,code=sm_61 \
-gencode arch=compute_61,code=compute_61

BLAS choice:

atlas for ATLAS (default)

mkl for MKL

open for OpenBlas

BLAS := atlas

Custom (MKL/ATLAS/OpenBLAS) include and lib directories.

Leave commented to accept the defaults for your choice of BLAS

(which should work)!

BLAS_INCLUDE := /path/to/your/blas

BLAS_LIB := /path/to/your/blas

Homebrew puts openblas in a directory that is not on the standard search path

BLAS_INCLUDE := $(shell brew –prefix openblas)/include

BLAS_LIB := $(shell brew –prefix openblas)/lib

This is required only if you will compile the matlab interface.

MATLAB directory should contain the mex binary in /bin.

MATLAB_DIR := /usr/local

MATLAB_DIR := /Applications/MATLAB_R2012b.app

NOTE: this is required only if you will compile the python interface.

We need to be able to find Python.h and numpy/arrayobject.h.

PYTHON_INCLUDE := /usr/include/python2.7 \

/usr/lib/python2.7/dist-packages/numpy/core/include

Anaconda Python distribution is quite popular. Include path:

Verify anaconda location, sometimes it’s in root.

ANACONDA_HOME := (HOME)/anacondaPYTHONINCLUDE:=(ANACONDA_HOME)/include \
# (ANACONDA_HOME)/include/python2.7?\??
????????#
(ANACONDA_HOME)/lib/python2.7/site-packages/numpy/core/include

Uncomment to use Python 3 (default is Python 2)

PYTHON_LIBRARIES := boost_python3 python3.5m

PYTHON_INCLUDE := /usr/include/python3.5m \

/usr/lib/python3.5/dist-packages/numpy/core/include

We need to be able to find libpythonX.X.so or .dylib.

PYTHON_LIB := /usr/lib

PYTHON_LIB := $(ANACONDA_HOME)/lib

Homebrew installs numpy in a non standard path (keg only)

PYTHON_INCLUDE += (dir(shell python -c ‘import numpy.core; print(numpy.core.file)’))/include

PYTHON_LIB += $(shell brew –prefix numpy)/lib

Uncomment to support layers written in Python (will link against Python libs)

WITH_PYTHON_LAYER := 1

Whatever else you find you need goes here.

INCLUDE_DIRS := (PYTHONINCLUDE)/usr/local/include/usr/include/hdf5/serialLIBRARYDIRS:=(PYTHON_LIB) /usr/local/lib /usr/lib /usr/lib/x86_64-linux-gnu /usr/lib/x86_64-linux-gnu/hdf5/serial

If Homebrew is installed at a non standard location (for example your home directory) and you use it for general dependencies

INCLUDE_DIRS += $(shell brew –prefix)/include

LIBRARY_DIRS += $(shell brew –prefix)/lib

NCCL acceleration switch (uncomment to build with NCCL)

https://github.com/NVIDIA/nccl (last tested version: v1.2.3-1+cuda8.0)

USE_NCCL := 1

Uncomment to use pkg-config to specify OpenCV library paths.

(Usually not necessary – OpenCV libraries are normally installed in one of the above $LIBRARY_DIRS.)

USE_PKG_CONFIG := 1

N.B. both build and distribute dirs are cleared on make clean

BUILD_DIR := build
DISTRIBUTE_DIR := distribute

Uncomment for debugging. Does not work on OSX due to https://github.com/BVLC/caffe/issues/171

DEBUG := 1

The ID of the GPU that ‘make runtest’ will use to run unit tests.

TEST_GPUID := 0

enable pretty build (comment to see full commands)

Q ?= @

find . -type f -exec sed -i -e ‘s^”hdf5.h”^”hdf5/serial/hdf5.h”^g’ -e ‘s^”hdf5_hl.h”^”hdf5/serial/hdf5_hl.h”^g’ ‘{}’ \;
cd /usr/lib/x86_64-linux-gnu
sudo ln -s libhdf5_serial.so.10.1.0 libhdf5.so
sudo ln -s libhdf5_serial_hl.so.10.0.2 libhdf5_hl.so
cd python
for req in (catrequirements.txt);dopipinstallreq; done
for req in (catrequirements.txt);dosudo?Hpipinstallreq –upgrade; done
cd ..#caffe文件夾下
make all -j8
make test -j8
make runtest -j8
make pycaffe
make distribute

如果沒(méi)錯(cuò)就是caffe配置好了,接下來(lái)是python接口。下載[acnaonda](https://www.continuum.io/downloads)然后:

bash Anaconda2-2.4.1-Linux-x86_64.sh#conda list可以查詢已經(jīng)安裝了那些python庫(kù),安裝命令conda install ×××

sudo gedit ~/.bashrc
export PYTHONPATH=/usr/local/caffe/python:$PYTHONPATH#此處為caffe文件下python文件夾的路徑
sudo ldconfig
sudo gedit Makefile.config#修改Makefile.config文件
sudo make pycaffe
sudo make test -j8
sudo make runtest -j8

測(cè)試python接口。

pthon
import caffe

沒(méi)有錯(cuò)就是ok的。安裝jupyter

sudo pip install jupyter
jupyter notebook
“`

?

轉(zhuǎn)載于:https://www.cnblogs.com/shyanguan/p/6582150.html

總結(jié)

以上是生活随笔為你收集整理的ubuntu16.04装机:网易云+搜狗拼音+chrome+uGet+caffe(openCV3.1+CUDA+cuDNN+python)的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。

如果覺(jué)得生活随笔網(wǎng)站內(nèi)容還不錯(cuò),歡迎將生活随笔推薦給好友。