欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

Mac 上搭建TensorFlow环境

程序员文章站 2022-07-07 21:29:50
...

参考地址

  • 安装HomeBrew
    /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
    实际地址以Homebrew主页显示为主
  • 安装Python
    brew install python
  • 安装pip
    sudo easy_install pip
    sudo easy_install --upgrade six
  • 安装tensorflow
    $pip install tensorflow
    $pip install tensorflow-gpu #GPU support version#
  • 测试tensorflow
$ python
...
>>> import tensorflow as tf
>>> hello = tf.constant('Hello, TensorFlow!')
>>> sess = tf.Session()
>>> print(sess.run(hello))
Hello, TensorFlow!
>>> a = tf.constant(10)
>>> b = tf.constant(32)
>>> print(sess.run(a + b))
42