linux下无权限安装anaconda和tensorflow-gpu

Anaconda

首先在自己的用户目录下安装 anaconda

./Anaconda3-5.0.1-Linux-x86_64.sh

安装完成之后添加anaconda环境

vim ~/.bashrc
export PATH=/home/zhangyt/anaconda3/bin:$PATH
source ~/.bashrc

添加清华镜像,执行下面命令两次,将清华镜像放在第一位

conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/

 创建pythonn3.6的解释器

conda create -n py36 python=3.6

添加cuda和cudnn的环境,服务器中已经安装了cuda和cudnn,需要知道它们的安装位置

vim ~/.bashrc
export PATH=/usr/local/cuda-10.1/bin:$PATH
export LD_LIBRARY_PATH=/usr/local/cuda-10.1/lib64:$LD_LIBRARY_PATH
source ~/.bashrc

 先升级一下pip

pip install --upgrade pip

开始安装tensorflow-gpu=1.13.1

pip install tensorflow-gpu==1.13.1

测试TensorFlow(GPU)是否安装成功

source activate py36

然后键入python 

import tensorflow as tf
hello = tf.constant('hello world')
sess=tf.Session()
print(sess.run(hello))

如下显示,说明tensorflow-gpu已经安装成功了

 

发布了102 篇原创文章 · 获赞 117 · 访问量 33万+

猜你喜欢

转载自blog.csdn.net/pursuit_zhangyu/article/details/104790035