Pypi.org browser to open the site, according to the instructions to install the latest version of virtualenv library, and then use the following command in the machine ~/development/
to create a learning environment isolated TensorFlow directory, the name is tensorflow
:
virtualenv --system-site-packages ~/development/tensorflow
Then we activate virtualenv created above, execute the following command:
cd ~/development/tensorflow
source bin/activate
At this time, some changes occurred in the terminal prompt, is the following picture with red coil out of the part, which indicates that we have entered the isolation of TensorFlow learning environment:
You can then named tensorflow
install TensorFlow virtualenv to the isolation container:
pip3 install --upgrade pip
pip3 list
pip3 install --upgrade tensorflow
After installation is complete, we have to verify whether the installation was successful:
python3 -c "import tensorflow as tf; tf.enable_eager_execution(); print(tf.reduce_sum(tf.random_normal([1000, 1000])))"
If the above command to output I tensorflow/core/platform/cpu_feature_guard.cc:141] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 FMA
information, do not be nervous, this tip means that we do not support the installation Tensorflow several CPU vector operation instruction code, has little effect on our learning process, just add import os; os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2';
directly to the screen to direct warning:
python3 -c "import os; os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2'; import tensorflow as tf; tf.enable_eager_execution(); print(tf.reduce_sum(tf.random_normal([1000, 1000])))"
The above code is not performed after the additional warning message, but directly outputs tf.Tensor(234.54535, shape=(), dtype=float32)
i.e. the calculation result, then we can use the following command to shut virtualenv container:
deactivate
Close the container after virtualenv how to open it, use the above activated when virtualenv use the command:
cd ~/development/tensorflow
source bin/activate