本文为Ubuntu系统Anaconda3-5.2.0 Python3.6.5的tensorflow1.12.0安装教程
指定版本安装
pip install --upgrade pip
Then
python -m pip install tensorflow-cpu==2.3.0 -i https://pypi.douban.com/simple/
首先查看python版本
python --version
搭建tensorflow环境
conda create -n tensorflow python=3.6.5
查看新建的环境
conda env list
source activate tensorflow
然后,选择pip或者conda安装tensorflow, 依据操作系统,Python版本,CPU版本还是CPU+GPU版本,选择合适的语句(下面的网站很慢,推荐国内镜像)
Ubuntu/Linux 64-bit, CPU only, Python 2.7
(tensorflow1)$ 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, GPU enabled, Python 2.7
Requires CUDA toolkit 7.5 and CuDNN v5. For other versions, see "Install from sources" below.
(tensorflow)$ export TF_BINARY_URL=https://storage.googleapis.com/tensorflow/linux/gpu/tensorflow-0.10.0-cp27-none-linux_x86_64.whl
Mac OS X, CPU only, Python 2.7:
(tensorflow)$ export TF_BINARY_URL=https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-0.10.0-py2-none-any.whl
Mac OS X, GPU enabled, Python 2.7:
(tensorflow)$ export TF_BINARY_URL=https://storage.googleapis.com/tensorflow/mac/gpu/tensorflow-0.10.0-py2-none-any.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, GPU enabled, Python 3.4
Requires CUDA toolkit 7.5 and CuDNN v5. For other versions, see "Install from sources" below.
(tensorflow)$ export TF_BINARY_URL=https://storage.googleapis.com/tensorflow/linux/gpu/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
Ubuntu/Linux 64-bit, GPU enabled, Python 3.5
Requires CUDA toolkit 7.5 and CuDNN v5. For other versions, see "Install from sources" below.
(tensorflow)$ export TF_BINARY_URL=https://storage.googleapis.com/tensorflow/linux/gpu/tensorflow-0.10.0-cp35-cp35m-linux_x86_64.whl
Mac OS X, CPU only, Python 3.4 or 3.5:
(tensorflow)$ export TF_BINARY_URL=https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-0.10.0-py3-none-any.whl
Mac OS X, GPU enabled, Python 3.4 or 3.5:
(tensorflow)$ export TF_BINARY_URL=https://storage.googleapis.com/tensorflow/mac/gpu/tensorflow-0.10.0-py3-none-any.whl
或者选择下面的代码
python -m pip install --upgrade wheel-URL
pick wheel-URL from below:
For Windows:
Python 3.6 CPU-only >> https://storage.googleapis.com/tensorflow/windows/cpu/tensorflow-1.12.0-cp36-cp36m-win_amd64.whl
Python 3.6 GPU support >> https://storage.googleapis.com/tensorflow/windows/gpu/tensorflow_gpu-1.12.0-cp36-cp36m-win_amd64.whl
For Linux:
Python 2.7 CPU-only >> https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-1.12.0-cp27-none-linux_x86_64.whl
Python 2.7 GPU support >> https://storage.googleapis.com/tensorflow/linux/gpu/tensorflow_gpu-1.12.0-cp27-none-linux_x86_64.whl
Python 3.6 CPU-only >> https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-1.12.0-cp36-cp36m-linux_x86_64.whl
Python 3.6 GPU support >> https://storage.googleapis.com/tensorflow/linux/gpu/tensorflow_gpu-1.12.0-cp36-cp36m-linux_x86_64.whl
macOS (CPU-only)
Python 2.7 >> https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-1.12.0-py2-none-any.whl
Python 3.4, 3.5, 3.6 >> https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-1.12.0-py3-none-any.whl
本次输入代码
export TF_BINARY_URL=https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-1.12.0-cp36-cp36m-linux_x86_64.whl
Python 2
(tensorflow)$ pip install --ignore-installed --upgrade $TF_BINARY_URL
Python 3
(tensorflow)$ pip3 install --ignore-installed --upgrade $TF_BINARY_URL
会因为网络原因报错很正常,重新输入指令即可
通过以下指令查看是否成功安装,下图最后一行
conda list
pip install spyder==*
查看支持的版本
spyder 4.0.0后面对应的应该是python3.7
选择3.3.6
pip install spyder==* -i https://pypi.douban.com/simple/