安裝anconda以及tensorflow一点记录
首先需要注意的是不要卸载Ubuntu自带的Python,卸载之后会卸载Ubuntu对应的一堆依赖库会很麻烦,我在卸载系统原带的Python之后,搞了一天最后还是重装系统了。
一.安装anaconda
首先从官网上下载anconda,用bash安装即可
bash ~/Download/Anaconda3-5.2.0-Linux-x86_64.sh
之前卸载了系统自带的Python导致了bash找不到解决了很久
安装成功之后可以用如下指令启动:
anaconda-navigator
二.安装tensorflow
首先安装GPU环境(不需要则不执行这句):
sudo apt-get install libcupti-dev
安装tensorflow环境(需要注意安装对应的Python版本,可以打开anconda查看对应的版本):
conda create -n tensorflow python=3.6
激活tensorflow环境:
source activate tensorflow
安装tensorflow(这里使用清华大学开源软件网站的内容,对应的不同的安装需求参考https://mirrors.tuna.tsinghua.edu.cn/tensorflow/linux/cpu/tensorflow-1.4.0-cp36-cp36m-linux_x86_64.whl):
pip install
-i https://pypi.tuna.tsinghua.edu.cn/simple/
https://mirrors.tuna.tsinghua.edu.cn/tensorflow/linux/cpu/tensorflow-1.10.0-cp36-cp36m-linux_x86_64.whl
我这里安装对应的CPU版本
验证安装成功:
开启anaconda,选择左边对应的Environments可以看到tensorflow的选项,在home下面,也可以下拉右侧的application选择tensorflow,选择相应的环境进行安装相应需要的需求。
window10安装tensordflow:
由于有的时候需要window10环境下配置tensorflow,window10环境下配置会有一些坑,所以这里写一点东西。
首先tensorflow不支持在Python 3.6环境下使用,3.6会出现很多缺少库的状况
打开prompt配置Python3.5环境,这里命名为 python35,可以自己命名
conda create --name python35 python=3.5
打开指定的环境
activate python35
安装清华大学镜像上最新版本
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple tensorflow
默认是CPU版本,默认可支持最新版本,用GPU版本则执行如下指令
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple tensorflow-gpu