pytorch版本管理:下载pytorch0.4.0简单方法

使用如下命令:

(python27) root:~# pip install torch==0.4

如果出现网络超时,如果情况:

Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple
Collecting torch==0.4
  Downloading https://pypi.tuna.tsinghua.edu.cn/packages/df/a4/7f5ec6e9df1bf13f1881353702aa9713fcd997481b26018f35e0be85faf7/torch-0.4.0-cp27-cp27mu-manylinux1_x86_64.whl (484.0 MB)
     |███▊                            | 55.6 MB 18 kB/s eta 6:35:25ERROR: Exception:

Traceback (most recent call last): File "/root/anaconda3/envs/python27/lib/python2.7/site-packages/pip/_internal/cli/base_command.py", line 188, in _main status = self.run(options, args) File "/root/anaconda3/envs/python27/lib/python2.7/site-packages/pip/_internal/cli/req_command.py", line 185, in wrapper return func(self, options, args) File "/root/anaconda3/envs/python27/lib/python2.7/site-packages/pip/_internal/commands/install.py", line 333, in run reqs, check_supported_wheels=not options.target_dir File "/root/anaconda3/envs/python27/lib/python2.7/site-packages/pip/_internal/resolution/legacy/resolver.py", line 179, in resolve discovered_reqs.extend(self._resolve_one(requirement_set, req)) File "/root/anaconda3/envs/python27/lib/python2.7/site-packages/pip/_internal/resolution/legacy/resolver.py", line 362, in _resolve_one abstract_dist = self._get_abstract_dist_for(req_to_install) File "/root/anaconda3/envs/python27/lib/python2.7/site-packages/pip/_internal/resolution/legacy/resolver.py", line 314, in _get_abstract_dist_for abstract_dist = self.preparer.prepare_linked_requirement(req) File "/root/anaconda3/envs/python27/lib/python2.7/site-packages/pip/_internal/operations/prepare.py", line 469, in prepare_linked_requirement hashes=hashes, File "/root/anaconda3/envs/python27/lib/python2.7/site-packages/pip/_internal/operations/prepare.py", line 259, in unpack_url hashes=hashes, File "/root/anaconda3/envs/python27/lib/python2.7/site-packages/pip/_internal/operations/prepare.py", line 130, in get_http_url link, downloader, temp_dir.path, hashes File "/root/anaconda3/envs/python27/lib/python2.7/site-packages/pip/_internal/operations/prepare.py", line 281, in _download_http_url for chunk in download.chunks: File "/root/anaconda3/envs/python27/lib/python2.7/site-packages/pip/_internal/cli/progress_bars.py", line 166, in iter for x in it: File "/root/anaconda3/envs/python27/lib/python2.7/site-packages/pip/_internal/network/utils.py", line 39, in response_chunks decode_content=False, File "/root/anaconda3/envs/python27/lib/python2.7/site-packages/pip/_vendor/urllib3/response.py", line 564, in stream data = self.read(amt=amt, decode_content=decode_content) File "/root/anaconda3/envs/python27/lib/python2.7/site-packages/pip/_vendor/urllib3/response.py", line 529, in read raise IncompleteRead(self._fp_bytes_read, self.length_remaining) File "/root/anaconda3/envs/python27/lib/python2.7/contextlib.py", line 35, in __exit__ self.gen.throw(type, value, traceback) File "/root/anaconda3/envs/python27/lib/python2.7/site-packages/pip/_vendor/urllib3/response.py", line 439, in _error_catcher raise ReadTimeoutError(self._pool, None, "Read timed out.") ReadTimeoutError: HTTPSConnectionPool(host='pypi.tuna.tsinghua.edu.cn', port=443): Read timed out.

解决方案:
添加 ‘–default-timeout=10000’

(python27) root@ecd910ad8a44:~/anaconda3/envs/python27/bin# pip --default-timeout=10000 install torch==0.4

下载成功:

Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple
Collecting torch==0.4
  Downloading https://pypi.tuna.tsinghua.edu.cn/packages/df/a4/7f5ec6e9df1bf13f1881353702aa9713fcd997481b26018f35e0be85faf7/torch-0.4.0-cp27-cp27mu-manylinux1_x86_64.whl (484.0 MB)
     |████████████████████████████████| 484.0 MB 13 kB/s 
Installing collected packages: torch
Successfully installed torch-0.4.0

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值