如何在python 3.86操作系统Windows 10(64位)中安装tensorflow



当我尝试使用类似的pip安装tensorflow时

pip install tensorflow

它给了我以下错误:

Collecting tensorflow
Downloading tensorflow-2.3.1-cp38-cp38-win_amd64.whl (342.5 MB)
|                                | 3.4 MB 12 kB/s eta 7:44:02ERROR: Exception:
Traceback (most recent call last):
File "c:userswin 10appdatalocalprogramspythonpython38libsite-packagespip_vendorurllib3response.py", line 437, in _error_catcher
yield
File "c:userswin 10appdatalocalprogramspythonpython38libsite-packagespip_vendorurllib3response.py", line 519, in read
data = self._fp.read(amt) if not fp_closed else b""
File "c:userswin 10appdatalocalprogramspythonpython38libsite-packagespip_vendorcachecontrolfilewrapper.py", line 62, in read
data = self.__fp.read(amt)
File "c:userswin 10appdatalocalprogramspythonpython38libhttpclient.py", line 458, in read
n = self.readinto(b)
File "c:userswin 10appdatalocalprogramspythonpython38libhttpclient.py", line 502, in readinto
n = self.fp.readinto(b)
File "c:userswin 10appdatalocalprogramspythonpython38libsocket.py", line 669, in readinto
return self._sock.recv_into(b)
File "c:userswin 10appdatalocalprogramspythonpython38libssl.py", line 1241, in recv_into
return self.read(nbytes, buffer)
File "c:userswin 10appdatalocalprogramspythonpython38libssl.py", line 1099, in read
return self._sslobj.read(len, buffer)
socket.timeout: The read operation timed out
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "c:userswin 10appdatalocalprogramspythonpython38libsite-packagespip_internalclibase_command.py", line 228, in _main
status = self.run(options, args)
File "c:userswin 10appdatalocalprogramspythonpython38libsite-packagespip_internalclireq_command.py", line 182, in wrapper
return func(self, options, args)
File "c:userswin 10appdatalocalprogramspythonpython38libsite-packagespip_internalcommandsinstall.py", line 323, in run
requirement_set = resolver.resolve(
File "c:userswin 10appdatalocalprogramspythonpython38libsite-packagespip_internalresolutionlegacyresolver.py", line 183, in resolve
discovered_reqs.extend(self._resolve_one(requirement_set, req))
File "c:userswin 10appdatalocalprogramspythonpython38libsite-packagespip_internalresolutionlegacyresolver.py", line 388, in _resolve_one
abstract_dist = self._get_abstract_dist_for(req_to_install)
File "c:userswin 10appdatalocalprogramspythonpython38libsite-packagespip_internalresolutionlegacyresolver.py", line 340, in _get_abstract_dist_for
abstract_dist = self.preparer.prepare_linked_requirement(req)
File "c:userswin 10appdatalocalprogramspythonpython38libsite-packagespip_internaloperationsprepare.py", line 467, in prepare_linked_requirement
local_file = unpack_url(
File "c:userswin 10appdatalocalprogramspythonpython38libsite-packagespip_internaloperationsprepare.py", line 255, in unpack_url
file = get_http_url(
File "c:userswin 10appdatalocalprogramspythonpython38libsite-packagespip_internaloperationsprepare.py", line 129, in get_http_url
from_path, content_type = _download_http_url(
File "c:userswin 10appdatalocalprogramspythonpython38libsite-packagespip_internaloperationsprepare.py", line 282, in _download_http_url
for chunk in download.chunks:
File "c:userswin 10appdatalocalprogramspythonpython38libsite-packagespip_internalcliprogress_bars.py", line 168, in iter
for x in it:
File "c:userswin 10appdatalocalprogramspythonpython38libsite-packagespip_internalnetworkutils.py", line 64, in response_chunks
for chunk in response.raw.stream(
File "c:userswin 10appdatalocalprogramspythonpython38libsite-packagespip_vendorurllib3response.py", line 576, in stream
data = self.read(amt=amt, decode_content=decode_content)
File "c:userswin 10appdatalocalprogramspythonpython38libsite-packagespip_vendorurllib3response.py", line 541, in read
raise IncompleteRead(self._fp_bytes_read, self.length_remaining)
File "c:userswin 10appdatalocalprogramspythonpython38libcontextlib.py", line 131, in __exit__
self.gen.throw(type, value, traceback)
File "c:userswin 10appdatalocalprogramspythonpython38libsite-packagespip_vendorurllib3response.py", line 442, in _error_catcher
raise ReadTimeoutError(self._pool, None, "Read timed out.")
pip._vendor.urllib3.exceptions.ReadTimeoutError: HTTPSConnectionPool(host='files.pythonhosted.org', port=443): Read timed out.

错误意味着什么?如何安装它

如果我在谷歌上搜索如何安装tensorflow,它告诉我从虚拟环境下载它,我不知道如何创建虚拟环境

如@Dr.所评论。史努比,错误看起来像是连接问题。Tensorflow 2.2或更高版本需要Python 3.8.更多信息,请访问Tensorflow官方网站。

正如@Raghav Gupta所建议的那样,conda负责处理包版本不兼容的问题。

conda create --name tf python=3.8 tensorflow #install python 3.8 and latest version of Tensorflow

最新更新