安装Python和pip:
$ sudo apt-get install python-pip python-dev #for Python 2.7
$ sudo apt-get install python3-pip python3-dev #for Python 3.n
安装Tensorflow:
$ pip install tensorflow #Python 2.7; CPU支持(不支持GPU)
$ pip3 install tensorflow #Python 3.n; CPU支持(不支持GPU)
$ pip install tensorflow-gpu #Python 2.7; GPU支持
$ pip3 install tensorflow-gpu #Python 3.n; GPU支持
若安装失败:
pip install --upgrade https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-1.4.1-cp27-none-linux_x86_64.whl #Python 2.7; CPU支持(不支持GPU
pip install --upgrade https://storage.googleapis.com/tensorflow/linux/gpu/tensorflow_gpu-1.4.1-cp27-none-linux_x86_64.whl #Python 2.7; GPU支持
pip3 install --upgrade https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-1.4.1-cp35-cp35m-linux_x86_64.whl #Python 3.n; CPU支持(不支持GPU)
pip3 install --upgrade https://storage.googleapis.com/tensorflow/linux/gpu/tensorflow_gpu-1.4.1-cp35-cp35m-linux_x86_64.whl #Python 3.n; GPU支持
终端提示:
无法获得锁 /var/lib/dpkg/lock - open (11: 资源暂时不可用)
E: 无法锁定管理目录(/var/lib/dpkg/),是否有其他进程正占用它?”
解决办法如下:
1.终端输入 ps -aux ,列出进程,找到含有apt-get的进程,直接sudo kill PID解决。
2.强制解锁--命令:
sudo rm /var/cache/apt/archives/lock
sudo rm /var/lib/dpkg/lock
$ sudo apt-get install python-pip python-dev #for Python 2.7
$ sudo apt-get install python3-pip python3-dev #for Python 3.n
安装Tensorflow:
$ pip install tensorflow #Python 2.7; CPU支持(不支持GPU)
$ pip3 install tensorflow #Python 3.n; CPU支持(不支持GPU)
$ pip install tensorflow-gpu #Python 2.7; GPU支持
$ pip3 install tensorflow-gpu #Python 3.n; GPU支持
若安装失败:
pip install --upgrade https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-1.4.1-cp27-none-linux_x86_64.whl #Python 2.7; CPU支持(不支持GPU
pip install --upgrade https://storage.googleapis.com/tensorflow/linux/gpu/tensorflow_gpu-1.4.1-cp27-none-linux_x86_64.whl #Python 2.7; GPU支持
pip3 install --upgrade https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-1.4.1-cp35-cp35m-linux_x86_64.whl #Python 3.n; CPU支持(不支持GPU)
pip3 install --upgrade https://storage.googleapis.com/tensorflow/linux/gpu/tensorflow_gpu-1.4.1-cp35-cp35m-linux_x86_64.whl #Python 3.n; GPU支持
终端提示:
无法获得锁 /var/lib/dpkg/lock - open (11: 资源暂时不可用)
E: 无法锁定管理目录(/var/lib/dpkg/),是否有其他进程正占用它?”
解决办法如下:
1.终端输入 ps -aux ,列出进程,找到含有apt-get的进程,直接sudo kill PID解决。
2.强制解锁--命令:
sudo rm /var/cache/apt/archives/lock
sudo rm /var/lib/dpkg/lock