TensorFlow 笔记1 Mac Python环境搭建

这是一个系列,记录我Tensorflow开发常用的代码,小常识,有些是参考网上代码,(讲的可能有点烂,求不要打脸,嘤嘤嘤~~)送给那些需要的人。可以相互交流,喜欢的加我吧。
Wx: Lxp911221

Mac Python环境搭建网上有好多例子,我就很开森的按照命令敲啊
打开终端:

sudo easy_install pip
sudo easy_install --upgrade six
sudo pip install --upgrade $TF_BINARY_URL

TF_BINARY_URL 参考列表
# Ubuntu/Linux 64-bit, CPU only, Python 2.7
$ export TF_BINARY_URL=https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-0.10.0-cp27-none-linux_x86_64.whl

# Ubuntu/Linux 64-bit, GPU enabled, Python 2.7
# Requires CUDA toolkit 7.5 and CuDNN v5. For other versions, see "Install from sources" below.
$ export TF_BINARY_URL=https://storage.googleapis.com/tensorflow/linux/gpu/tensorflow-0.10.0-cp27-none-linux_x86_64.whl

# Mac OS X, CPU only, Python 2.7:
$ export TF_BINARY_URL=https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-0.10.0-py2-none-any.whl

# Mac OS X, GPU enabled, Python 2.7:
$ export TF_BINARY_URL=https://storage.googleapis.com/tensorflow/mac/gpu/tensorflow-0.10.0-py2-none-any.whl

# Ubuntu/Linux 64-bit, CPU only, Python 3.4
$ export TF_BINARY_URL=https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-0.10.0-cp34-cp34m-linux_x86_64.whl

# Ubuntu/Linux 64-bit, GPU enabled, Python 3.4
# Requires CUDA toolkit 7.5 and CuDNN v5. For other versions, see "Install from sources" below.
$ export TF_BINARY_URL=https://storage.googleapis.com/tensorflow/linux/gpu/tensorflow-0.10.0-cp34-cp34m-linux_x86_64.whl

# Ubuntu/Linux 64-bit, CPU only, Python 3.5
$ export TF_BINARY_URL=https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-0.10.0-cp35-cp35m-linux_x86_64.whl

# Ubuntu/Linux 64-bit, GPU enabled, Python 3.5
# Requires CUDA toolkit 7.5 and CuDNN v5. For other versions, see "Install from sources" below.
$ export TF_BINARY_URL=https://storage.googleapis.com/tensorflow/linux/gpu/tensorflow-0.10.0-cp35-cp35m-linux_x86_64.whl

# Mac OS X, CPU only, Python 3.4 or 3.5:
$ export TF_BINARY_URL=https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-0.10.0-py3-none-any.whl

# Mac OS X, GPU enabled, Python 3.4 or 3.5:
$ export TF_BINARY_URL=https://storage.googleapis.com/tensorflow/mac/gpu/tensorflow-0.10.0-py3

but 有错误。为什么,感觉我被世界抛弃了
既然Mac系统的不让我用,我只能自己再搭建一套Python环境了,Python3开始:

Step 1 安装Xcode:
最简单App Store,什么?你嫌太慢可以给你快点
Xcode 8.3.1
http://adcdownload.apple.com/Developer_Tools/Xcode_8.3.1/Xcode_8.3.1.xip
复制到迅雷,下载速度飕飕的。xcode8以后必须把你的系统升级到最新版本
打开终端:

xcode-select --install

Step 2安装套件管理工具Homebrew:

ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

Step 3 安装Python:

brew install python3
打开python3安装文件
open /usr/local/Cellar/

python3
pip3
python3的命令和python有区别,没错后边有个3,这是系统默认的,不会造成冲突。
忘记了一条命令,敲完下班
pip3 install --upgrade $TF_BINARY_URL 推荐
或者:pip3 install tensorflow

代码编辑工具 推荐vs code
下载链接 https://code.visualstudio.com/
具体配置看下文
备胎(PyCharm)

猜你喜欢

转载自blog.csdn.net/zzk220106/article/details/72478003