Ubuntu16.04下安裝tensorflow(Anaconda3+pycharm+tensorflow+CPU)
1.下載並安裝Anaconda
1.1 下載
從Anaconda官網(https://www.continuum.io/downloads)上下載Linux版本
https://repo.continuum.io/archive/(推薦python3.5)
1.2 安裝
cd ~/Downloads
sudo bash Anaconda2-5.0.1-Linux-x86_64.sh (這裏下載了Python2.7的對應版本)
詢問是否把anaconda的bin添加到用戶的環境變量中,選擇yes!
安裝完成。
2.安裝tensorflow
2.1 建立tensorflow運行環境
# Python 2.7
$ conda create -n tensorflow python=2.7
# Python 3.4
$ conda create -n tensorflow python=3.4
# Python 3.5
$ conda create -n tensorflow python=3.5
2.2 在conda環境下安裝tensorflow(pip安裝方式)
2.2.1 激活conda環境
$ source activate tensorflow
2.2.2 根據tensorflow的版本設置環境變量(以CPU版本為例)
# Ubuntu/Linux 64-bit, CPU only, Python 2.7
(tensorflow)$ export TF_BINARY_URL=https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-0.10.0-cp27-none-linux_x86_64.whl
# Ubuntu/Linux 64-bit, CPU only, Python 3.4
(tensorflow)$ export TF_BINARY_URL=https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-0.10.0-cp34-cp34m-linux_x86_64.whl
# Ubuntu/Linux 64-bit, CPU only, Python 3.5
(tensorflow)$ export TF_BINARY_URL=https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-0.10.0-cp35-cp35m-linux_x86_64.whl
2.2.3 安裝tensorflow
# Python 2
(tensorflow)$ pip install --ignore-installed --upgrade $TF_BINARY_URL
# Python 3
(tensorflow)$ pip3 install --ignore-installed --upgrade $TF_BINARY_URL
這裏註意不要使用sudo命令,否則在設置pycharm時候會提示找不到tensorflow。另外,如果提示沒有找到pip3,請使用 sudo apt-get install python3-pip 安裝。
上述步驟安裝完成後,從conda環境中退出
(tensorflow)$ source deactivate
安裝完成。
http://blog.csdn.net/zzc15806/article/details/73662491
Ubuntu16.04下安裝tensorflow(Anaconda3+pycharm+tensorflow+CPU)