在代理后面安装Tensorflow时遇到的问题

时间:2018-09-19 16:00:58

标签: installation conda http-proxy

我当前正在使用Python(版本:3.5.2 |Anaconda 4.2.0 (64-bit)|)。当我尝试安装tensorflow时,它抛出一个错误。我不知道该怎么解决。错误如下:

Collecting tensorflow
Cache entry deserialization failed, entry ignored
Retrying (Retry(total=4, connect=None, read=None, redirect=None)) after 
connection broken by 'ProxyError('Cannot connect to proxy.', OSError('Tunnel 
connection failed: 407 Proxy Authentication Required',))': 
/simple/tensorflow/
Retrying (Retry(total=3, connect=None, read=None, redirect=None)) after 
connection broken by 'ProxyError('Cannot connect to proxy.', OSError('Tunnel 
connection failed: 407 Proxy Authentication Required',))': 
/simple/tensorflow/
Retrying (Retry(total=2, connect=None, read=None, redirect=None)) after 
connection broken by 'ProxyError('Cannot connect to proxy.', OSError('Tunnel 
connection failed: 407 Proxy Authentication Required',))': 
/simple/tensorflow/
Retrying (Retry(total=1, connect=None, read=None, redirect=None)) after 
connection broken by 'ProxyError('Cannot connect to proxy.', OSError('Tunnel 
connection failed: 407 Proxy Authentication Required',))': 
/simple/tensorflow/
Retrying (Retry(total=0, connect=None, read=None, redirect=None)) after 
connection broken by 'ProxyError('Cannot connect to proxy.', OSError('Tunnel 
connection failed: 407 Proxy Authentication Required',))': 
/simple/tensorflow/
Could not find a version that satisfies the requirement tensorflow (from 
versions: )
No matching distribution found for tensorflow
Cache entry deserialization failed, entry ignored

我没有任何互联网连接问题。有人可以帮助我吗?

1 个答案:

答案 0 :(得分:0)

要在代理后面安装tensorflow,请执行以下步骤

步骤1:设置环境变量

HTTP_PROXY = http://user:password@proxy:portnumber

HTTPS_PROXY = https://user:password@proxy:portnumber

步骤2:在.condarc文件中设置代理服务器。

在/Users/username/.condarc中的“ .condarc”文件中,添加以下几行

proxy_servers:
  http: http://user:password@proxy:portnumber
  https: https://user:password@proxy:portnumber

第3步:通过Anaconda安装(conda提示)

方法1:

打开conda提示符,通过以下命令创建新的安装环境

conda create -n tensorflow
activate tensorflow
conda install jupyter
conda install scipy
conda install tensorflow

方法2:

下载以下列出的文件:

    来自link
  1. tensorflow jar名称为win-64 / tensorflow-1.3.0-py36_0.tar.bz2
  2. 来自link
  3. 名称为win-64 / protobuf-3.2.0-py36_0.tar.bz2的protobuf jar
  4. 来自link
  5. repodata.json.bz2

现在在conda提示符下,移至下载的目录并输入以下命令

conda install tensorflow-1.3.0-py36_0.tar.bz2
conda install protobuf-3.2.0-py36_0.tar.bz2

现在,您都可以通过方法1或方法2进行设置。

要从conda提示符本身检查安装,请提供以下命令

python ####this will open python workspace from conda
import tensorflow as tf ####if running this didnt gave any error u r all set

注意: 如果任何conda命令不起作用(因为您在代理下),请提供以下命令:

conda config --set ssl_verify no
set NO_PROXY=continuum.io,anaconda.org

希望这会有所帮助:)