Tensorflow installation

Ref: https://www.tensorflow.org/install/install_mac

1. 安裝 virtual env
 $ sudo easy_install pip
 $ sudo pip install --upgrade virtualenv
 
2. 假設用 ~/tensorflow 當目錄
 $ virtualenv --system-site-packages ~/tensorflow
 

3. 執行

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

  • (tensorflow)$

  • 離開
    (tensorflow)$ deactivate

    4. 驗證

    hello-tf.py
    ----
    import tensorflow as tf

    hello = tf.constant("Hello, TensorFlow!");
    sess = tf.Session()

    print(sess.run(hello))
    -----

    (tensorflow)$ hello-tf.py

    W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE4.1 instructions, but these are available on your machine and could speed up CPU computations.
    W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE4.2 instructions, but these are available on your machine and could speed up CPU computations.
    W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use AVX instructions, but these are available on your machine and could speed up CPU computations.
    Hello, TensorFlow!




    留言

    熱門文章