• 第一步安装virtualenv

    1.  

    1. $ sudo easy_install pip  

    2. $ sudo pip install --upgrade virtualenv 

     

    第二步创建一个沙盒目录

    Create a Virtualenv environment in the directory ~/tensorflow:

    $ virtualenv --system-site-packages ~/tensorflow

    第三步c初始化环境变量

    Activate the environment:

    $ source ~/tensorflow/bin/activate  # If using bash 

    停用环境

    Deactivate

     

    Python

    import tensorflow as tf

    hello = tf.constant('Hello, TensorFlow!')

    sess = tf.Session()

     print(sess.run(hello))