openpose环境搭建(全教程)
⽬录
⼀、Ubuntu的安装
制作启动盘
1、安装USB Install
2、Set a Persistent file size for storing changes 是选择⼀个固定的⽂件存储空间,即如果你登⼊系统后,对系统有任何更改,将保存到U盘中,如果选择0,则不会保存。
3、它就会把ISO的东西写⼊U盘了
写完之后,U盘名称被改为“UUI”。
装机
在U盘的Ubuntu启动菜单中选择“Try Ubuntu”,或者“Install Ubuntu”直接从U盘安装(我这⾥为了截图⽅便所以选择的是“Try Ubuntu”)
进⼊“Try Ubuntu 16.04.2 LTS”后,双击桌⾯上的“Install Ubuntu 16.04.2 LTS”
2、设置分区,boot 700M  /home 80G  /剩余 :系统、软件安装 swap 16G
3、设置⽤户和密码
4、正式开始安装拷贝数据了。
5、完成后会提⽰重新启动,重启后即可进⼊系统。
⼆、安装nvidia显卡驱动
第⼀步获取显卡型号
想办法获取⾃⼰nvidia显卡的型号(⼀般买电脑的时候都会有显卡型号,我的显卡型号是在电脑上的⼀个贴纸上),本⼈的显卡是
GTX970M。
第⼆步去查看⽀持 GTX1080ti 显卡的驱动的最新版本的版本号
第三步查询⽀持GTX1080ti显卡的显卡驱动的其他驱动版本
第四步安装
下⾯我们使⽤ppa⽅式安装384版本驱动,⽽不是最新的390版本驱动
想要驱动GPU,就需要安装GPU驱动(我是的GTX1080ti),可能有时候通过NVIDIA官⽹下载显卡驱动⽐较慢,我们可以添加ppa库,通过ppa安装显卡驱动,这步可有可⽆,⽤户⾃⾏决定,输⼊代码如下:
sudo add-apt-repository ppa:graphics-drivers/ppa
sudo apt-get install nvidia-384
安装好了,重启系统,使⽤下⾯命令,可以查看GPU
nvidia-smi
三、安装cuda+cudnn
第⼀步安装nvida驱动
安装nvidia驱动,我们已经安装了。
第⼆步安装cuda8.0
1、下载cuda
进⼊ ,选择合适的 CUDA 类型下载。(建议下载8.0或者9.0,不要下载最新的版本,因为好多框架可能还不⽀持,导致后⾯各个深度学习框架安装报错,并且去官⽹重新下载,⽤已经安装过会报奇怪的错误)
如上图所⽰我选择的是linux x86_64 ubuntu 16.04环境,最后⼀个选项是安装包形式,我选择的是runfile安装包,点击downlad即可下载
2、安装cuda相关依赖
sudo apt-get install freeglut3-dev build-essential libx11-dev libxmu-dev libxi-dev libgl1-mesa-glx libglu1-mesa libglu1-mesa-dev
3、安装cuda
1. 1.进⼊⽂件所在的⽬录,⽤下列命令安装
s udo sh cuda_9.0.176_384.81_linux.run
1. 2.安装 ,会让你先读⽂章,你就直接按空格键就ok
Do you accept the previously read EULA?
accept/decline/quit: accept
Install NVIDIA Accelerated Graphics Driver for Linux-x86_64 367.48?
(y)es/(n)o/(q)uit: n
Install the CUDA 8.0 Toolkit?
(y)es/(n)o/(q)uit: y
Enter Toolkit Location
[ default is /usr/local/cuda-9.0 ]:
Do you want to install a symbolic link at /usr/local/cuda?
(y)es/(n)o/(q)uit: y
Install the CUDA 9.0 Samples?
(y)es/(n)o/(q)uit: y
1. 3.若⽆警告和报错,出现下列显⽰,即安装暂时成功。
Installing the CUDA Toolkit in /usr/local/cuda-9.0 …
Installing the CUDA Samples in /home/textminer …
Copying samples to /home/textminer/NVIDIA_CUDA-9.0_Samples now…
Finished copying samples.
===========
= Summary =
===========
Driver: Not Selected
Toolkit: Installed in /usr/local/cuda-9.0
Samples: Installed in /home/textminer
Please make sure that
– PATH includes /usr/local/cuda-9.0/bin
– LD_LIBRARY_PATH includes /usr/local/cuda-9.0/lib64, or, add /usr/local/cuda-9.0/lib64 to /etc/f and run ldconfig as root
To uninstall the CUDA Toolkit, run the uninstall script in /usr/local/cuda-8.0/bin
Please see CUDA_Installation_Guide_Linux.pdf in /usr/local/cuda-8.0/doc/pdf for detailed information on setting up CUDA.
***WARNING: Incomplete installation! This installation did not install the CUDA Driver. A driver of version at least 361.00 is required for CUDA 9.0 functionality to w To install the driver using this installer, run the following command, replacing with the name of this run file:
sudo .run -silent -driver
Logfile is /tmp/cuda_install_6583.log
1. 4.配置环境变量
echo 'export PATH=/usr/local/cuda/bin:$PATH' >> ~/.bashrc
echo 'export LD_LIBRARY_PATH=/usr/local/cuda/lib64:$LD_LIBRARY_PATH' >> ~/.bashrc
source ~/.bashrc
第三步安装cudnn(注意要和cuda版本相符合)1. 下载cudnn-9.
ubuntu安装教程
1. 2.解压并复制到/usr/local
sudo tar -xzf cudnn-9. -C /usr/local
# 也就是把cudnn解压后把cudnn.h和libcudnn*放到cuda安装⽬录⾥⾯去sudo cp cuda/include/cudnn.h /usr/local/cuda/include/
sudo cp cuda/lib64/libcudnn* /usr/local/cuda/lib64/
sudo chmod a+r /usr/local/cuda/include/cudnn.h
sudo chmod a+r /usr/local/cuda/lib64/libcudnn*
四、安装opencv
⽅法⼀:通过apt-get安装opencv2
sudo apt update
sudo apt upgrade
sudo apt install libopencv-dev python-opencv
查看是否安装成功
pkg-config --modversion opencv
如果输出了opencv2.4 的版本信息,说明安装成功
⽅法⼆:通过源码安装opencv3
五、Caff搭建
第⼀步安装相关依赖库
sudo apt-get --assume-yes install build-essential
sudo apt-get install libprotobuf-dev libleveldb-dev libsnappy-dev libopencv-dev libhdf5-serial-dev protobuf-compiler
sudo apt-get install --no-install-recommends libboost-all-dev
sudo apt-get install libopenblas-dev liblapack-dev libatlas-base-dev
sudo apt-get install libgflags-dev libgoogle-glog-dev liblmdb-dev
# Python libs
sudo -H pip install --upgrade numpy protobuf
第⼆步下载caffe
下载caffe
1. 使⽤Git直接下载Caffe ,没安装git就按照提⽰安装⼀下
git clone github/BVLC/caffe.git
cd caffe
第三步修改fig
1、进⼊ caffe ,将 ample ⽂件复制⼀份并更名为 fig ,也可以在 caffe ⽬录下直接调⽤以下命令完成复制操作 :
sudo fig
复制⼀份的原因是编译 caffe 时需要的是 fig ⽂件,⽽ample 只是caffe 给出的配置⽂件例⼦,不能⽤来编译 caffe。
2、修改 fig ⽂件,在 caffe ⽬录下打开该⽂件:
sudo fig
在⽂件中替换⼀下⼏个地⽅: