1.首先安装环境是ubuntu18.04.

$sudo apt-get install python-pip python-dev python-virtualenv
2.安装virtualenv虚拟环境
$ virtualenv --system-site-packages ~/tensorflow
$ cd ~/tensorflow

3.激活虚拟机
$source bin/activate 
4.在虚拟机内安装tensorflow

$sudo pip install --upgrade https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-0.8.0-cp27-none-linux_x86_64.whl
5退出虚拟环境

$deactivate