ubuntu 16.04 安装anaconda三、Cuda9.0、Tensorflow-GPU深度学习环境搭建

 

如何在Ubuntu下安装Anaconda及搭建环境安装TensorFlow深度学习框架

https://blog.csdn.net/u010899985/article/details/59482825php

史上最全的ubuntu16.04安装nvidia驱动+cuda9.0+cuDnn7.0 

https://blog.csdn.net/fdqw_sph/article/details/78745375python

Ubuntu 16.04 上安装 CUDA 9.0 详细教程

http://www.javashuo.com/article/p-umijoiiw-nq.htmllinux

Ubuntu 16.04 + Nvidia 显卡驱动 + Cuda 8.0 (问题总结 + 解决方案)

https://blog.csdn.net/zafir_410/article/details/73188228?utm_source=itdadao&utm_medium=referraljson

Ubuntu16.04深度学习环境配置——Anaconda(基于Python3.5)+Tensorflow(GPU版本)的安装以及在PyCharm中的使用

https://blog.csdn.net/AllenIrving/article/details/80406709ubuntu

 

问题总结:api

Q1:我在安装anaconda过程当中,直接跳过了PATH的安装以下图:bash

遇到这种状况只能本身添加了:框架

一、到根目录下,打开终端并输入:学习

sudo gedit ~/.bashrc

二、在.bashrc文件末尾添加的路径: 测试

#export PATH=/home/xxx/anaconda3/bin:$PATH 

保存并关闭文件

三、使其当即生效,在终端执行:

source ~/.bashrc

四、测试anaconda安装成功:

anaconda -V

 五、打开anaconda-navigator

$ anaconda-navigator

  

Q2: 安装Anaconda后,须要安装Tensorflow出现问题:

conda create -n tensorflow python=3.6   #我下的TensorFlow对应的Python是3.6版本,那么我就使用这行

错误信息: 
CondaHTTPError: HTTP 000 CONNECTION FAILED for url <https://repo.continuum.io/pkgs/main/win-64/repodata.json.bz2> 
Elapsed: -  

解决办法:

sudo gedit ~/.condarc

删除文件中 -defaults那一行便可。

 

Anaconda使用:

激活和关闭环境:

source activate tensorflow #激活环境(这里tensorflow 是你本身的环境名称)
source deactivate tensorflow #关闭环境 

调用激活后环境中的jupyter notebook(必定要给激活环境安装jupyter notebook)

$ ipython notebook

 

 修改jupyter的目录:

jupyter notebook --generate-config

 

安装Tensorflow:

一、换源(若是出现URL错误的话)

 

二、安装Tensorflow-gpu

conda install tensorflow-gpu 
若是失败试试:

pip install tensorflow-gpu
若是pip3 install --upgrade tensorflow-gpu失败的话,先安装pip
sudo apt install python3-pip
或者:
pip install --ignore-installed --upgrade https://storage.googleapis.com/tensorflow/linux/gpu/tensorflow_gpu-1.8.0-cp36-cp36m-linux_x86_64.whl

安装keras:(若是须要)
pip install keras

三、测试Tensorflow 

 

import tensorflow as tf
a = tf.constant([1.0, 2.0, 3.0, 4.0, 5.0, 6.0], shape=[2, 3], name='a')
b = tf.constant([1.0, 2.0, 3.0, 4.0, 5.0, 6.0], shape=[3, 2], name='b')
c = tf.matmul(a, b)
sess = tf.Session(config=tf.ConfigProto(log_device_placement=True))
print(sess.run(c))

 

四、查看Tensorflow版本号

python
import tensorflow as tf
tf.__version__

或者:
anaconda search -t conda tensorflow 

 

Ubuntu关机重启命令简介:
重启命令:
一、reboot
二、shutdown -r now 马上重启(root用户使用)
三、shutdown -r 10 过10分钟自动重启(root用户使用)
四、shutdown -r 20:35 在时间为20:35时候重启(root用户使用)

 

若是ubantu分区根目录空间过小,能够经过挂载方式解决:

http://forum.ubuntu.org.cn/viewtopic.php?f=86&t=80493

相关文章
相关标签/搜索