繁体   English   中英

Pip无法安装tensorflow

[英]Pip fails to install tensorflow

我正在尝试在Windows 7的离线计算机上安装tensorflow。我以前在whl文件上使用pip完成了这项工作,但是现在我正在尝试使用tensorflow-gpu,我得到了一个意外的错误:

> pip install -v tensorflow_gpu-1.2.0-cp36-CP36m-win-amd64.whl
Config variable 'Py_DEBUG' is unset, Python ABI tag may be incorrect
Config variable 'WITH_PYMALLOC' is unset, Python ABI tag may be incorrect
Requirement already satisfied: tensorflow-gpu==1.2.0 from file:///C:/Users/T0024528/Documents/installers/tensorflow_gpu-1.2.0-cp36-cp36m-win_amd64.whl in c:\programdata\anaconda3\lib\site-packages
Requirement already satisfied: numpy>=1.11.0 in c:\programdata\anaconda3\lib\site-packages (from tensorflow-gpu==1.2.0)
Requirement already satisfied: wheel>=0.26 in c:\programdata\anaconda3\lib\site-packages (from tensorflow-gpu==1.2.0)
Requirement already satisfied: protobuf>=3.2.0 in c:\programdata\anaconda3\lib\site-packages (from tensorflow-gpu==1.2.0)
Requirement already satisfied: six>=1.10.0 in c:\programdata\anaconda3\lib\site-packages (from tensorflow-gpu==1.2.0)
Requirement already satisfied: markdown==2.2.0 in c:\programdata\anaconda3\lib\site-packages (from tensorflow-gpu==1.2.0)
Requirement already satisfied: html5lib==0.9999999 in c:\programdata\anaconda3\lib\site-packages (from tensorflow-gpu==1.2.0)
Requirement already satisfied: bleach==1.5.0 in c:\programdata\anaconda3\lib\site-packages (from tensorflow-gpu==1.2.0)
Requirement already satisfied: backports.weakref==1.0rc1 in c:\programdata\anaconda3\lib\site-packages (from tensorflow-gpu==1.2.0)
Requirement already satisfied: werkzeug>=0.11.10 in c:\programdata\anaconda3\lib\site-packages (from tensorflow-gpu==1.2.0)
Requirement already satisfied: setuptools in c:\programdata\anaconda3\lib\site-packages\setuptools-27.2.0-py3.6.egg (from protobuf>=3.2.0->tensorflow-gpu==1.2.0)
Cleaning up...
Looking up "https://pypi.python.org/pypi/pip/json" in the cache
No cache entry available
Starting new HTTPS connection (1): pypi.python.org
There was an error checking the latest version of pip
Traceback (most recent call last):
  File "C:\ProgramData\Anaconda3\lib\site-packages\pip\_vendor\requests\packages\urllib3\connection.py", line 142, in _new_conn
(self.host, self.port), self.timeout, **extra_kw)
  File "C:\ProgramData\Anaconda3\lib\site-packages\pip\_vendor\requests\packages\urllib3\util\connection.py", line 75, in create_connection
for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM):
  File "C:\ProgramData\Anaconda3\lib\socket.py", line 743, in getaddrinfo
for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
socket.gaierror: [Errno 11004] getaddrinfo failed

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\ProgramData\Anaconda3\lib\site-packages\pip\_vendor\requests\packages\urllib3\connectionpool.py", line 595, in urlopen
chunked=chunked)
  File "C:\ProgramData\Anaconda3\lib\site-packages\pip\_vendor\requests\packages\urllib3\connectionpool.py", line 352, in _make_request
self._validate_conn(conn)
  File "C:\ProgramData\Anaconda3\lib\site-packages\pip\_vendor\requests\packages\urllib3\connectionpool.py", line 831, in _validate_conn
conn.connect()
  File "C:\ProgramData\Anaconda3\lib\site-packages\pip\_vendor\requests\packages\urllib3\connection.py", line 254, in connect
conn = self._new_conn()
  File "C:\ProgramData\Anaconda3\lib\site-packages\pip\_vendor\requests\packages\urllib3\connection.py", line 151, in _new_conn
self, "Failed to establish a new connection: %s" % e)
pip._vendor.requests.packages.urllib3.exceptions.NewConnectionError: <pip._vendor.requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x00000000048262B0>: Failed to establish a new connection: [Errno 11004] getaddrinfo failed

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\ProgramData\Anaconda3\lib\site-packages\pip\_vendor\requests\adapters.py", line 423, in send
timeout=timeout
  File "C:\ProgramData\Anaconda3\lib\site-packages\pip\_vendor\requests\packages\urllib3\connectionpool.py", line 640, in urlopen
_stacktrace=sys.exc_info()[2])
  File "C:\ProgramData\Anaconda3\lib\site-packages\pip\_vendor\requests\packages\urllib3\util\retry.py", line 287, in increment
raise MaxRetryError(_pool, url, error or ResponseError(cause))
pip._vendor.requests.packages.urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='pypi.python.org', port=443): Max retries exceeded with url: /pypi/pip/json (Caused by NewConnectionError('<pip._vendor.requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x00000000048262B0>: Failed to establish a new connection: [Errno 11004] getaddrinfo failed',))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\ProgramData\Anaconda3\lib\site-packages\pip\utils\outdated.py", line 126, in pip_version_check
headers={"Accept": "application/json"},
  File "C:\ProgramData\Anaconda3\lib\site-packages\pip\_vendor\requests\sessions.py", line 488, in get
return self.request('GET', url, **kwargs)
  File "C:\ProgramData\Anaconda3\lib\site-packages\pip\download.py", line 386, in request
return super(PipSession, self).request(method, url, *args, **kwargs)
  File "C:\ProgramData\Anaconda3\lib\site-packages\pip\_vendor\requests\sessions.py", line 475, in request
resp = self.send(prep, **send_kwargs)
  File "C:\ProgramData\Anaconda3\lib\site-packages\pip\_vendor\requests\sessions.py", line 596, in send
r = adapter.send(request, **kwargs)
  File "C:\ProgramData\Anaconda3\lib\site-packages\pip\_vendor\cachecontrol\adapter.py", line 47, in send
resp = super(CacheControlAdapter, self).send(request, **kw)
  File "C:\ProgramData\Anaconda3\lib\site-packages\pip\_vendor\requests\adapters.py", line 487, in send
raise ConnectionError(e, request=request)
pip._vendor.requests.exceptions.ConnectionError: HTTPSConnectionPool(host='pypi.python.org', port=443): Max retries exceeded with url: /pypi/pip/json (Caused by NewConnectionError('<pip._vendor.requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x00000000048262B0>: Failed to establish a new connection: [Errno 11004] getaddrinfo failed',))

似乎pip试图下载https://pypi.python.org/pypi/pip/json ,它之前没有尝试过。 我怎么解决这个问题?

对于类似的问题,这有助于我:

  1. 设置https_proxy env。 变量到您的HTTPS代理:

     > set https_proxy=myproxy.org:port > pip install ... 

我建议将https_proxy设置为系统或用户级env。 变量为未来......

  1. 或者提供代理作为pip的参数:

     > pip --proxy=myproxy.org:port ... 

AFAIK,在Windows 7上,您可以通过以下方式显示代理设置:

> netsh winhttp show proxy

(希望也包括httpS代理......)

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM