Ubuntu 18.04机器学习环境安装

安装net-tools
sudo apt install net-tools
#查看IP
ifconfig
#ssh服务是否安装
ps -e | grep ssh
#安装openssh-server
apt-get install openssh-server

#卸载原显卡驱动    
sudo -s -H
sudo apt-get purge nvidia*

lspci | grep nouveau
ubuntu-drivers devices

sudo apt-get update

安装gcc、g++
sudo apt-get install gcc --fix-missing
sudo apt-get install g++ --fix-missing
sudo apt-get install make --fix-missing
   
sudo sh ./NVIDIA-Linux-x86_64-390.87.run --no-opengl-files
必须加上 --no-opengl-files ,否则会出现题主要是三种,(1)循环登录,也就是登录之后在退出来到登录界面; (2)界面变得很大,看着心慌,哈哈;(3)登录进去了,显示正常了,结果只有桌面背景和鼠标等等

reboot

#验证显卡驱动是否安装完成
watch -n 1 nvidia-smi

#安装远程桌面
sudo apt-get install xrdp
sudo apt-get install vnc4server
sudo apt-get install xubuntu-desktop
echo "xfce4-session" >~/.xsession
sudo gedit /etc/xrdp/startwm.sh
sudo gedit /etc/X11/Xwrapper.config
sudo service xrdp restart

#安装Anaconda3
sudo apt install vim
bash Anaconda3-5.2.0-Linux-x86_64.sh

#安装cuda
sudo apt-get install gcc-4.8 
sudo apt-get install g++-4.8
cd /usr/bin

sudo mv gcc gcc.bak
sudo ln -s gcc-4.8 gcc
sudo mv g++ g++.bak 
sudo ln -s g++-4.8 g++
gcc -v 
g++ -v

sudo sh cuda_9.0.176_384.81_linux.run --override

sh cuda_9.0.176.1_linux.run
sh cuda_9.0.176.2_linux.run

tar zxvf cudnn-9.0-linux-x64-v7.1.tgz
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 /usr/local/cuda/lib64/libcudnn*

#验证cuda安装
cd /home/hylink/NVIDIA_CUDA-9.0_Samples/1_Utilities/deviceQuery/
sudo make
./deviceQuery

#更新环境变量
echo 'export PATH=/usr/local/cuda-9.0/bin${PATH:+:${PATH}}' >> ~/.bashrc
echo 'export LD_LIBRARY_PATH=/usr/local/cuda-9.0/lib64${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}' >> ~/.bashrc
source ~/.bashrc
python -V

unzip faces_emore.zip

#安装dmidecode
sudo apt-get install dmidecode
sudo gedit /etc/sudoers

Python依赖环境安装
pip install tensorflow-gpu==1.8.0 -i http://pypi.douban.com/simple --trusted-host pypi.douban.com
pip install --upgrade pip -i http://pypi.douban.com/simple --trusted-host pypi.douban.com
pip install torch torchvision   
pip install mxnet-cu90 -i http://pypi.douban.com/simple --trusted-host pypi.douban.com
pip install opencv-python==3.4.5.20 -i http://pypi.douban.com/simple --trusted-host pypi.douban.com
pip install opencv-contrib-python==3.4.5.20 -i http://pypi.douban.com/simple --trusted-host pypi.douban.com
pip install licensetool
pip install easydict -i http://pypi.douban.com/simple --trusted-host pypi.douban.com
pip install tqdm -i http://pypi.douban.com/simple --trusted-host pypi.douban.com
pip install bcolz -i http://pypi.douban.com/simple --trusted-host pypi.douban.com
pip install rsa -i http://pypi.douban.com/simple --trusted-host pypi.douban.com

posted on 2019-05-06 11:21  疯狂的小萝卜头  阅读(366)  评论(0编辑  收藏  举报