在Mac下安装TensorFlow出错

在Mac下安装TensorFlow出错

(tensorflow)  alfred@Alfred  pip install --ignore-installed --upgrade https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-1.12.0-py2-none-any.whl
Collecting tensorflow==1.12.0 from https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-1.12.0-py2-none-any.whl
  Downloading https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-1.12.0-py2-none-any.whl (62.0MB)
    2% |█                               | 1.8MB 16kB/s eta 0:59:58Exception:
Traceback (most recent call last):
  File "/Users/alfred.pz/anaconda3/envs/tensorflow/lib/python2.7/site-packages/pip/_internal/cli/base_command.py", line 143, in main
    status = self.run(options, args)
  File "/Users/alfred.pz/anaconda3/envs/tensorflow/lib/python2.7/site-packages/pip/_internal/commands/install.py", line 318, in run
    resolver.resolve(requirement_set)
  File "/Users/alfred.pz/anaconda3/envs/tensorflow/lib/python2.7/site-packages/pip/_internal/resolve.py", line 102, in resolve
    self._resolve_one(requirement_set, req)
  File "/Users/alfred.pz/anaconda3/envs/tensorflow/lib/python2.7/site-packages/pip/_internal/resolve.py", line 256, in _resolve_one
    abstract_dist = self._get_abstract_dist_for(req_to_install)
  File "/Users/alfred.pz/anaconda3/envs/tensorflow/lib/python2.7/site-packages/pip/_internal/resolve.py", line 209, in _get_abstract_dist_for
    self.require_hashes
  File "/Users/alfred.pz/anaconda3/envs/tensorflow/lib/python2.7/site-packages/pip/_internal/operations/prepare.py", line 283, in prepare_linked_requirement
    progress_bar=self.progress_bar
  File "/Users/alfred.pz/anaconda3/envs/tensorflow/lib/python2.7/site-packages/pip/_internal/download.py", line 836, in unpack_url
    progress_bar=progress_bar
  File "/Users/alfred.pz/anaconda3/envs/tensorflow/lib/python2.7/site-packages/pip/_internal/download.py", line 673, in unpack_http_url
    progress_bar)
  File "/Users/alfred.pz/anaconda3/envs/tensorflow/lib/python2.7/site-packages/pip/_internal/download.py", line 897, in _download_http_url
    _download_url(resp, link, content_file, hashes, progress_bar)
  File "/Users/alfred.pz/anaconda3/envs/tensorflow/lib/python2.7/site-packages/pip/_internal/download.py", line 619, in _download_url
    consume(downloaded_chunks)
  File "/Users/alfred.pz/anaconda3/envs/tensorflow/lib/python2.7/site-packages/pip/_internal/utils/misc.py", line 848, in consume
    deque(iterator, maxlen=0)
  File "/Users/alfred.pz/anaconda3/envs/tensorflow/lib/python2.7/site-packages/pip/_internal/download.py", line 585, in written_chunks
    for chunk in chunks:
  File "/Users/alfred.pz/anaconda3/envs/tensorflow/lib/python2.7/site-packages/pip/_internal/utils/ui.py", line 159, in iter
    for x in it:
  File "/Users/alfred.pz/anaconda3/envs/tensorflow/lib/python2.7/site-packages/pip/_internal/download.py", line 574, in resp_read
    decode_content=False):
  File "/Users/alfred.pz/anaconda3/envs/tensorflow/lib/python2.7/site-packages/pip/_vendor/urllib3/response.py", line 465, in stream
    data = self.read(amt=amt, decode_content=decode_content)
  File "/Users/alfred.pz/anaconda3/envs/tensorflow/lib/python2.7/site-packages/pip/_vendor/urllib3/response.py", line 430, in read
    raise IncompleteRead(self._fp_bytes_read, self.length_remaining)
  File "/Users/alfred.pz/anaconda3/envs/tensorflow/lib/python2.7/contextlib.py", line 35, in __exit__
    self.gen.throw(type, value, traceback)
  File "/Users/alfred.pz/anaconda3/envs/tensorflow/lib/python2.7/site-packages/pip/_vendor/urllib3/response.py", line 345, in _error_catcher
    raise ReadTimeoutError(self._pool, None, 'Read timed out.')
ReadTimeoutError: HTTPSConnectionPool(host='storage.googleapis.com', port=443): Read timed out.
(tensorflow)  alfred@Alfred  pip install --ignore-installed --upgrade https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-1.12.0-py2-none-any.whl

直接在linux下通过wget 获取下载

[root@local ~]# wget https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-1.12.0-py2-none-any.whl
--2018-11-17 14:01:44--  https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-1.12.0-py2-none-any.whl
Resolving storage.googleapis.com (storage.googleapis.com)... 172.217.161.144, 2404:6800:4005:801::2010
Connecting to storage.googleapis.com (storage.googleapis.com)|172.217.161.144|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 62030841 (59M) [application/octet-stream]
Saving to: ‘tensorflow-1.12.0-py2-none-any.whl’

100%[==============================================================================================================>] 62,030,841  1003KB/s   in 2m 56s 

2018-11-17 14:04:46 (343 KB/s) - ‘tensorflow-1.12.0-py2-none-any.whl’ saved [62030841/62030841]

[root@ local ~]# ll
-rw-r--r--  1 root root 62030841 Nov  6 08:47 tensorflow-1.12.0-py2-none-any.whl

然后通过httpd服务

然后在次在mac下执行命令

pip install --ignore-installed --upgrade http://10.88.88.122/soft/tensorflow-1.12.0-py2-none-any.whl


安装完成!!!

在安装过程中还是有异常

 Downloading https://files.pythonhosted.org/packages/b5/61/c12d3d8abc719efbea9f87d92f3d70ecf30b366ec34f7a5d8f6725d98146/grpcio-1.16.1-cp27-cp27m-macosx_10_12_x86_64.whl (1.7MB)
    67% |█████████████████████▌          | 1.2MB 17kB/s eta 0:00:34Exception:
Traceback (most recent call last):

.....


File "/Users/alfred.pz/anaconda3/envs/tensorflow/lib/python2.7/contextlib.py", line 35, in __exit__
    self.gen.throw(type, value, traceback)
  File "/Users/alfred.pz/anaconda3/envs/tensorflow/lib/python2.7/site-packages/pip/_vendor/urllib3/response.py", line 345, in _error_catcher
    raise ReadTimeoutError(self._pool, None, 'Read timed out.')
ReadTimeoutError: HTTPSConnectionPool(host='files.pythonhosted.org', port=443): Read timed out.

直接拷贝下载链接,在linux上通过wget下载,然后通过httpd在mac上执行

pip install --ignore-installed --upgrade http://10.88.88.122/soft/grpcio-1.16.1-cp27-cp27m-macosx_10_12_x86_64.whl

(tensorflow)  alfred@Alfred  pip install --ignore-installed --upgrade http://10.88.88.122/soft/grpcio-1.16.1-cp27-cp27m-macosx_10_12_x86_64.whl
Collecting grpcio==1.16.1 from http://10.88.88.122/soft/grpcio-1.16.1-cp27-cp27m-macosx_10_12_x86_64.whl
  Downloading http://10.88.88.122/soft/grpcio-1.16.1-cp27-cp27m-macosx_10_12_x86_64.whl (1.7MB)
    100% |████████████████████████████████| 1.7MB 11.5MB/s
Collecting six>=1.5.2 (from grpcio==1.16.1)
  Using cached https://files.pythonhosted.org/packages/67/4b/141a581104b1f6397bfa78ac9d43d8ad29a7ca43ea90a2d863fe3056e86a/six-1.11.0-py2.py3-none-any.whl
Collecting futures>=2.2.0 (from grpcio==1.16.1)
  Downloading https://files.pythonhosted.org/packages/2d/99/b2c4e9d5a30f6471e410a146232b4118e697fa3ffc06d6a65efde84debd0/futures-3.2.0-py2-none-any.whl
Collecting enum34>=1.0.4 (from grpcio==1.16.1)
  Using cached https://files.pythonhosted.org/packages/c5/db/e56e6b4bbac7c4a06de1c50de6fe1ef3810018ae11732a50f15f62c7d050/enum34-1.1.6-py2-none-any.whl
Installing collected packages: six, futures, enum34, grpcio
Successfully installed enum34-1.1.6 futures-3.2.0 grpcio-1.16.1 six-1.11.0
(tensorflow)  alfred@Alfred 

你可能感兴趣的:(在Mac下安装TensorFlow出错)