赞
踩
一:下载安装包先是安装了cpu版本pytorch1.4.0,链接地址如下:
下载相应版本的即可,如我的电脑anaconda下的yolov5的虚拟环境python=3.6,电脑时64位的,故下载时选了
torch-1.4.0+cpu-cp36-cp36m-win_amd64.whl
然后在激活环境后,切换到这个安装包所在的文件下,然后执行pip安装即可
pip install torch-1.4.0+cpu-cp36-cp36m-win_amd64.whl
二:当我以同样的方式安装torchvision时出现了问题,
pip install torchvision-0.5.0+cpu-cp36-cp36m-win_amd64.whl
报错
ERROR: Exception:
Traceback (most recent call last):
File "C:\ProgramData\Anaconda3\envs\yolov5\lib\site-packages\pip\_internal\cli\base_command.py", line 173, in _main
status = self.run(options, args)
File "C:\ProgramData\Anaconda3\envs\yolov5\lib\site-packages\pip\_internal\cli\req_command.py", line 203, in wrapper
return func(self, options, args)
File "C:\ProgramData\Anaconda3\envs\yolov5\lib\site-packages\pip\_internal\commands\install.py", line 316, in run
reqs, check_supported_wheels=not options.target_dir
File "C:\ProgramData\Anaconda3\envs\yolov5\lib\site-packages\pip\_internal\resolution\resolvelib\resolver.py", line 95, in resolve
collected.requirements, max_rounds=try_to_avoid_resolution_too_deep
File "C:\ProgramData\Anaconda3\envs\yolov5\lib\site-packages\pip\_vendor\resolvelib\resolvers.py", line 472, in resolve
state = resolution.resolve(requirements, max_rounds=max_rounds)
File "C:\ProgramData\Anaconda3\envs\yolov5\lib\site-packages\pip\_vendor\resolvelib\resolvers.py", line 341, in resolve
self._add_to_criteria(self.state.criteria, r, parent=None)
File "C:\ProgramData\Anaconda3\envs\yolov5\lib\site-packages\pip\_vendor\resolvelib\resolvers.py", line 172, in _add_to_criteria
if not criterion.candidates:
File "C:\ProgramData\Anaconda3\envs\yolov5\lib\site-packages\pip\_vendor\resolvelib\structs.py", line 151, in __bool__
return bool(self._sequence)
File "C:\ProgramData\Anaconda3\envs\yolov5\lib\site-packages\pip\_internal\resolution\resolvelib\found_candidates.py", line 140, in __bool__
return any(self)
File "C:\ProgramData\Anaconda3\envs\yolov5\lib\site-packages\pip\_internal\resolution\resolvelib\found_candidates.py", line 128, in <genexpr>
return (c for c in iterator if id(c) not in self._incompatible_ids)
File "C:\ProgramData\Anaconda3\envs\yolov5\lib\site-packages\pip\_internal\resolution\resolvelib\found_candidates.py", line 29, in _iter_built
for version, func in infos:
File "C:\ProgramData\Anaconda3\envs\yolov5\lib\site-packages\pip\_internal\resolution\resolvelib\factory.py", line 275, in iter_index_candidate_infos
hashes=hashes,
File "C:\ProgramData\Anaconda3\envs\yolov5\lib\site-packages\pip\_internal\index\package_finder.py", line 851, in find_best_candidate
candidates = self.find_all_candidates(project_name)
File "C:\ProgramData\Anaconda3\envs\yolov5\lib\site-packages\pip\_internal\index\package_finder.py", line 798, in find_all_candidates
page_candidates = list(page_candidates_it)
File "C:\ProgramData\Anaconda3\envs\yolov5\lib\site-packages\pip\_internal\index\sources.py", line 134, in page_candidates
yield from self._candidates_from_page(self._link)
File "C:\ProgramData\Anaconda3\envs\yolov5\lib\site-packages\pip\_internal\index\package_finder.py", line 758, in process_project_url
html_page = self._link_collector.fetch_page(project_url)
File "C:\ProgramData\Anaconda3\envs\yolov5\lib\site-packages\pip\_internal\index\collector.py", line 490, in fetch_page
return _get_html_page(location, session=self.session)
File "C:\ProgramData\Anaconda3\envs\yolov5\lib\site-packages\pip\_internal\index\collector.py", line 400, in _get_html_page
resp = _get_html_response(url, session=session)
File "C:\ProgramData\Anaconda3\envs\yolov5\lib\site-packages\pip\_internal\index\collector.py", line 132, in _get_html_response
"Cache-Control": "max-age=0",
File "C:\ProgramData\Anaconda3\envs\yolov5\lib\site-packages\pip\_vendor\requests\sessions.py", line 555, in get
return self.request('GET', url, **kwargs)
File "C:\ProgramData\Anaconda3\envs\yolov5\lib\site-packages\pip\_internal\network\session.py", line 454, in request
return super().request(method, url, *args, **kwargs)
File "C:\ProgramData\Anaconda3\envs\yolov5\lib\site-packages\pip\_vendor\requests\sessions.py", line 542, in request
resp = self.send(prep, **send_kwargs)
File "C:\ProgramData\Anaconda3\envs\yolov5\lib\site-packages\pip\_vendor\requests\sessions.py", line 655, in send
r = adapter.send(request, **kwargs)
File "C:\ProgramData\Anaconda3\envs\yolov5\lib\site-packages\pip\_vendor\cachecontrol\adapter.py", line 53, in send
resp = super(CacheControlAdapter, self).send(request, **kw)
File "C:\ProgramData\Anaconda3\envs\yolov5\lib\site-packages\pip\_vendor\requests\adapters.py", line 449, in send
timeout=timeout
File "C:\ProgramData\Anaconda3\envs\yolov5\lib\site-packages\pip\_vendor\urllib3\connectionpool.py", line 696, in urlopen
self._prepare_proxy(conn)
File "C:\ProgramData\Anaconda3\envs\yolov5\lib\site-packages\pip\_vendor\urllib3\connectionpool.py", line 964, in _prepare_proxy
conn.connect()
File "C:\ProgramData\Anaconda3\envs\yolov5\lib\site-packages\pip\_vendor\urllib3\connection.py", line 359, in connect
conn = self._connect_tls_proxy(hostname, conn)
File "C:\ProgramData\Anaconda3\envs\yolov5\lib\site-packages\pip\_vendor\urllib3\connection.py", line 506, in _connect_tls_proxy
ssl_context=ssl_context,
File "C:\ProgramData\Anaconda3\envs\yolov5\lib\site-packages\pip\_vendor\urllib3\util\ssl_.py", line 453, in ssl_wrap_socket
ssl_sock = _ssl_wrap_socket_impl(sock, context, tls_in_tls)
File "C:\ProgramData\Anaconda3\envs\yolov5\lib\site-packages\pip\_vendor\urllib3\util\ssl_.py", line 495, in _ssl_wrap_socket_impl
return ssl_context.wrap_socket(sock)
File "C:\ProgramData\Anaconda3\envs\yolov5\lib\ssl.py", line 407, in wrap_socket
_context=self, _session=session)
File "C:\ProgramData\Anaconda3\envs\yolov5\lib\ssl.py", line 773, in __init__
raise ValueError("check_hostname requires server_hostname")
ValueError: check_hostname requires server_hostname
看了网上说是网络问题, 但是我按着别人的方法没有解决,于是我就换了一个版本
安装0.6版本的torchvision,
结果出现一个新的警告,我看好像需要添加豆瓣源把相应的依赖库装上吧。
WARNING: The repository located at pypi.douban.com is not a trusted or secure host and is being ignored. If this repository is available via HTTPS we recommend you use HTTPS instead, otherwise you may silence this warning and allow it anyway with '--trusted-host pypi.douban.com'.
ERROR: Could not find a version that satisfies the requirement numpy (from torchvision) (from versions: none)
ERROR: No matching distribution found for numpy
WARNING: The repository located at pypi.douban.com is not a trusted or secure host and is being ignored. If this repository is available via HTTPS we recommend you use HTTPS instead, otherwise you may silence this warning and allow it anyway with '--trusted-host pypi.douban.com'.
于是我把命令改为
pip install torchvision-0.6.0+cpu-cp36-cp36m-win_amd64.whl --trusted-host pypi.douban.com
解决。
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。