TensorFlow-环境配置

来源:互联网 发布:ubuntu ssh使用教程 编辑:程序博客网 时间:2024/06/07 09:46

1.TensorFlow官方环境配置

2.TensorFlow简要教程系列(一)Mac安装TensorFlow

按照官方的方法走,我发现,第一步我就走不下去。我是MacOS系统,第一步是安装pip。

命令是:sudo easy_install pip

结果是卡在那,一个晚上都没结果,下面是截图:


然后各种搜索,换了一种方式:

1.
如果没有wget, 那么brew install wget
2.用wget下载
wget https://bootstrap.pypa.io/get-pip.py
3.安装
sudo python get-pip.py
4.(pip在第3步已经安装好,开始官方的第二步,安装virtualenv
sudo pip install --upgrade virtualenv

5. 创建一个virtualenv环境(下面有两个命令,选一个,第一个是为Python 2.7创建的环境,第二个是为Python 3.n):

virtualenv --system-site-packages targetDirectory # for Python 2.7

virtualenv --system-site-packages -p python3 targetDirectory # for Python 3.n

拷贝第5步命令,下面是执行结果:
New python executable in /Users/用户/targetDirectory/bin/python

6.安装tensorflow:

pip install tensorflow


7.激活virtualenv环境通过x下面两条命令任意一个,#号后面是对这个命令的说明,一般是第一个

source ~/tensorflow/bin/activate      # If using bash, sh, ksh, or zsh
source ~/tensorflow/bin/activate.csh  # If using csh or tcsh 



第二种方式:直接使用anaconda

从这里下载:https://mirrors.tuna.tsinghua.edu.cn/anaconda/archive/

下载慢?配个清华的镜像源,

终端输入:

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