ubuntu16.04 64-bit
python3.5
virtualenv
docker
ref: https://www.tensorflow.org/versions/r0.11/get_started/os_setup.html#virtualenv-installation
官网上有详细的安装流程,考虑到对现有python环境的影响,我准备用docker或virtualenv安装
virtualenv安装tensorflow
- install pip and virtualenv
- create a virtualenv environment
- activate the virtualenv environment and install tensorflow in it
after the install you will activate the virtualenv environment each time you want to use tensorflow
$ sudo apt-get install python3-pip python3-dev python3-virtualenv $ virtualenv --system-site-packages ~/tensorflow $ source ~/tensorflow/bin/activate (tensorflow)$ #your prompt should change 选择适合自己的安装包 # Ubuntu/Linux 64-bit, CPU only, Python 3.5 (tensorflow)$ export TF_BINARY_URL=https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-0.11.0rc0-cp35-cp35m-linux_x86_64.whl #install tensorflow (tensorflow)$ pip3 install --upgrade $TF_BINARY_URL #test your installation (tensorflow)$ python3 >>> import tensorflow as tf >>> hello = tf.constant('Hello, TensorFlow!') >>> sess = tf.Session() >>> sess.run(hello) Hello, TensorFlow! >>> a = tf.constant(10) >>> b = tf.constant(32) >>> sess.run(a+b) 42 >>>exit() #结束使用tensorflow virtualenv (tensorflow)$ deactivate $ #your prompt should change
Docker安装Tensorflow
docker安装过程中一种pulling不下来镜像,待续…
用了vpn后pulling下来了…
docker的安装和使用见docker使用记录
$ docker run -it -p 8888:8888 gcr.io/tensorflow/tensorflow
Tensorflow使用
Pycharm
在pycharm中可以在setting——>project interpretor中选择之前建立好的tensorflow virtualenv虚拟环境中的python3,这样就可以在pycharm中用啦