1.安装anaconda
①下载
wget https://repo.anaconda.com/archive/Anaconda3-2019.03-Linux-x86_64.sh
②安装
bash Anaconda3-2019.03-Linux-x86_64.sh
③换源
conda config --add channels http://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free
conda config --add channels http://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/
conda config --set show_channel_urls yes
③测试
conda list
2.安装tensorflow-gpu1.14
①创建虚拟环境
conda create -n tf1.14 python=3.7
②bashrc添加
1.输入:vi ~/.bashrc
2.按i进入insert模式粘贴以下三行:
if [ -f ~/.bashrc ] ; then
source .bashrc
fi
3.按ESC,再按:wq保存退出文件
4.输入:source ~/.bashrc
③激活tf1.14环境
source activate tf1.14
④下载tensorflow-gpu
或手动安装,再pip进去 镜像源
conda install tensorflow-gpu==1.14
⑤安装cuda10
conda install cudatoolkit=10.0
⑥安装cudnn(conda自动安装与版本匹配的)
conda install cudnn
3.测试和退出
①测试
python
import tensorflow as tf
tf.test.is_gpu_available()
②退出环境
source deactivate
4.linux命令
先激活环境,再cd到代码所在文件夹,若不挂起(退出终端则停止),直接python test1.py
#查看GPU
nvidia-smi
#显示所有虚拟环境
conda env list
#查看环境
conda list
#删除tf环境
conda remove -n tf1.14 --all
#后台挂起test.py
nohup python -u test.py > test.log 2>&1 &
#批量删除文件
mkdir 空文件名
rsync -a --delete 空文件名/ 删除的文件名/
#传文件夹
1.打包 tar -cvf 文件夹名.tar 文件夹名/
2.传输 scp命令
3.解压 tar -xvf 文件名.tar