Development environment: Mac OS 10.12.5Python 2.7.10GCC 4.2.1
Mac default is no pip, install PIP.
sudo easy_install pip
1. Installing virtualenv
sudo pip install virtualenv--upgrade
Create a working directory:
sudo virtualenv--system-site-packages ~/tensorflow
Make the directory, activate the sandbox
CD ~/tensorflow
SOURCE Bin/activate
Install TensorFlow in 2.virtualenv
After entering the sandbox, execute the following command to install TensorFlow:
(tensorflow) $ sudo pip install tensorflow==1.2.1
3. Running TensorFlow
...
Environment/users/***/tensorflow
Successfully installed BACKPORTS.WEAKREF-1.0RC1 bleach-1.5.0 funcsigs-1.0.2 html5lib-0.9999999 markdown-2.6.8 mock-2.0.0 numpy-1.13.0 pbr-3.1.1 protobuf-3.3.0 six-1.10.0 tensorflow-1.2.1 werkzeug-0.12.
Hello World tests:
$ Pythonpython 2.7.10 (default, Feb 7, 00:08:15) [GCC 4.2.1 Compatible Apple LLVM 8.0.0 (clang-800.0.34)] on Darwint Ype "Help", "copyright", "credits" or "license" for more information.>>> >>> import TensorFlow as tf> >> Hello =tf.constant (' Hello world! ') >>> sess = tf. Session () 2017-07-05 23:58:34.771619:w tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn ' T compiled to usage SSE4.2 instructions, but these is available on your machine and could speed up CPU computations.2017-07 -05 23:58:34.771654:w tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn ' t compiled to use AV X instructions, but these is available on your machine and could speed up CPU computations.2017-07-05 23:58:34.771663:w TENSORFLOW/CORE/PLATFORM/CPU_FEATURE_GUARD.CC:45] The TensorFlow library wasn ' t compiled to use AVX2 instructions, but th ESE is available on your machine and could speed up CPU computations.2017-07-05 23:58:34.771671:w tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn ' t compiled to use FMA instruct Ions, but these is available on your machine and could speed up CPU computations.>>> print sess.run (hello) Hello world!
Congratulations, TensorFlow installation was successful.
* Each time you run the TensorFlow program, you need to go to the TensorFlow directory and execute the source Bin/activate command to activate the sandbox.
*ubuntu/linux can also be prepared on Mac OS. The TensorFlow installation version is divided into CPU and GPU versions, with the following differences:
(tensorflow) $ sudo pip install tensorflow==1.2.1
(tensorflow) $ sudo pip install tensorflow-gpu==1.2.1
TensorFlow Getting Started: Mac installation TensorFlow