环境:虚拟机centos7(centos6.x会因为glibc版本出问题)
官方文档:https://www.tensorflow.org/versions/r0.10/get_started/os_setup.html#using-conda
1.安装anaconda
2.使用anaconda安装tf
有两种方法
一是按照官方文档
source activate tensorflow
conda install -c conda-forge tensorflow
二是安装conda-forge:https://github.com/conda-forge/tensorflow-feedstock
conda config --add channels conda-forge
conda install tensorflow
然而这两种方法都遇到了不同的网络问题:requests.packages.urllib3.exceptions.ProtocolError: ("Connection broken: error(104, 'Connection reset by peer')", error(104, 'Connection reset by peer'))
Could not connect to https://conda.anaconda.org/conda-forge/linux-64/tensorflow-0.9.0-py27_0.tar.bz2
Error: Connection error: EOF occurred in violation of protocol (_ssl.c:590): https://conda.anaconda.org/conda-forge/linux-64/tensorflow-0.9.0-py27_0.tar.bz2
因而转而用pip安装
export TF_BINARY_URL=https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-0.10.0rc0-cp27-none-linux_x86_64.whl
(tensorflow)$ pip install --ignore-installed --upgrade $TF_BINARY_URL
然而下载了安装包之后报错:
Found existing installation: setuptools 23.0.0
Cannot remove entries from nonexistent file /root/anaconda2/envs/tensorflow/lib/python2.7/site-packages/easy-install.pth
使用conda remove setuptools也不成功
最后将
pip install --ignore-installed --upgrade $TF_BINARY_URL
改为
pip install $TF_BINARY_URL
问题解决