python初心者です。
pipからopencvをインストールしようと思っています。
pip
1 pip install opencv-python
と入力すると、
pip
1Collecting opencv-python 2 Downloading opencv_python-4.5.1.48-cp37-cp37m-win32.whl (25.9 MB) 3 |█ | 808 kB 13 kB/s eta 0:31:35ERROR: Exception: 4Traceback (most recent call last): 5 File "c:\users****\appdata\local\programs\python\python37-32\lib\site-packages\pip\_vendor\resolvelib\resolvers.py", line 171, 6in _merge_into_criterion 7 crit = self.state.criteria[name] 8KeyError: 'opencv-python' 9 10During handling of the above exception, another exception occurred: 11 12Traceback (most recent call last): 13 File "c:\users****\appdata\local\programs\python\python37-32\lib\site-packages\pip\_vendor\urllib3\response.py", line 438, in _error_catcher 14 yield 15 File "c:\users****\appdata\local\programs\python\python37-32\lib\site-packages\pip\_vendor\urllib3\response.py", line 519, in read 16 data = self._fp.read(amt) if not fp_closed else b"" 17 File "c:\users****\appdata\local\programs\python\python37-32\lib\site-packages\pip\_vendor\cachecontrol\filewrapper.py", line 62, in read 18 data = self.__fp.read(amt) 19 File "c:\users****\appdata\local\programs\python\python37-32\lib\http\client.py", line 447, in read 20 n = self.readinto(b) 21 File "c:\users****\appdata\local\programs\python\python37-32\lib\http\client.py", line 491, in readinto 22 n = self.fp.readinto(b) 23 File "c:\users****\appdata\local\programs\python\python37-32\lib\socket.py", line 589, in readinto 24 return self._sock.recv_into(b) 25 File "c:\users****\appdata\local\programs\python\python37-32\lib\ssl.py", line 1052, in recv_into 26 return self.read(nbytes, buffer) 27 File "c:\users****\appdata\local\programs\python\python37-32\lib\ssl.py", line 911, in read 28 return self._sslobj.read(len, buffer) 29socket.timeout: The read operation timed out 30 31During handling of the above exception, another exception occurred: 32 33Traceback (most recent call last): 34 File "c:\users****\appdata\local\programs\python\python37-32\lib\site-packages\pip\_internal\cli\base_command.py", line 189, in _main 35 status = self.run(options, args) 36 File "c:\users****\appdata\local\programs\python\python37-32\lib\site-packages\pip\_internal\cli\req_command.py", line 178, in 37wrapper 38 return func(self, options, args) 39 File "c:\users****\appdata\local\programs\python\python37-32\lib\site-packages\pip\_internal\commands\install.py", line 317, in run 40 reqs, check_supported_wheels=not options.target_dir 41 File "c:\users****\appdata\local\programs\python\python37-32\lib\site-packages\pip\_internal\resolution\resolvelib\resolver.py", line 122, in resolve 42 requirements, max_rounds=try_to_avoid_resolution_too_deep, 43 File "c:\users****\appdata\local\programs\python\python37-32\lib\site-packages\pip\_vendor\resolvelib\resolvers.py", line 453, 44in resolve 45 state = resolution.resolve(requirements, max_rounds=max_rounds) 46 File "c:\users****\appdata\local\programs\python\python37-32\lib\site-packages\pip\_vendor\resolvelib\resolvers.py", line 318, 47in resolve 48 name, crit = self._merge_into_criterion(r, parent=None) 49 File "c:\users****\appdata\local\programs\python\python37-32\lib\site-packages\pip\_vendor\resolvelib\resolvers.py", line 173, 50in _merge_into_criterion 51 crit = Criterion.from_requirement(self._p, requirement, parent) 52 File "c:\users****\appdata\local\programs\python\python37-32\lib\site-packages\pip\_vendor\resolvelib\resolvers.py", line 82, in from_requirement 53 if not cands: 54 File "c:\users****\appdata\local\programs\python\python37-32\lib\site-packages\pip\_vendor\resolvelib\structs.py", line 124, in __bool__ 55 return bool(self._sequence) 56 File "c:\users****\appdata\local\programs\python\python37-32\lib\site-packages\pip\_internal\resolution\resolvelib\found_candidates.py", line 143, in __bool__ 57 return any(self) 58 File "c:\users****\appdata\local\programs\python\python37-32\lib\site-packages\pip\_internal\resolution\resolvelib\found_candidates.py", line 38, in _iter_built 59 candidate = func() 60 File "c:\users****\appdata\local\programs\python\python37-32\lib\site-packages\pip\_internal\resolution\resolvelib\factory.py", line 169, in _make_candidate_from_link 61 name=name, version=version, 62 File "c:\users****\appdata\local\programs\python\python37-32\lib\site-packages\pip\_internal\resolution\resolvelib\candidates.py", line 306, in __init__ 63 version=version, 64 File "c:\users****\appdata\local\programs\python\python37-32\lib\site-packages\pip\_internal\resolution\resolvelib\candidates.py", line 144, in __init__ 65 self.dist = self._prepare() 66 File "c:\users****\appdata\local\programs\python\python37-32\lib\site-packages\pip\_internal\resolution\resolvelib\candidates.py", line 226, in _prepare 67 dist = self._prepare_distribution() 68 File "c:\users****\appdata\local\programs\python\python37-32\lib\site-packages\pip\_internal\resolution\resolvelib\candidates.py", line 312, in _prepare_distribution 69 self._ireq, parallel_builds=True, 70 File "c:\users****\appdata\local\programs\python\python37-32\lib\site-packages\pip\_internal\operations\prepare.py", line 457, 71in prepare_linked_requirement 72 return self._prepare_linked_requirement(req, parallel_builds) 73 File "c:\users****\appdata\local\programs\python\python37-32\lib\site-packages\pip\_internal\operations\prepare.py", line 482, 74in _prepare_linked_requirement 75 self.download_dir, hashes, 76 File "c:\users****\appdata\local\programs\python\python37-32\lib\site-packages\pip\_internal\operations\prepare.py", line 234, 77in unpack_url 78 hashes=hashes, 79 File "c:\users****\appdata\local\programs\python\python37-32\lib\site-packages\pip\_internal\operations\prepare.py", line 108, 80in get_http_url 81 from_path, content_type = download(link, temp_dir.path) 82 File "c:\users****\appdata\local\programs\python\python37-32\lib\site-packages\pip\_internal\network\download.py", line 163, in __call__ 83 for chunk in chunks: 84 File "c:\users****\appdata\local\programs\python\python37-32\lib\site-packages\pip\_internal\cli\progress_bars.py", line 159, in iter 85 for x in it: 86 File "c:\users****\appdata\local\programs\python\python37-32\lib\site-packages\pip\_internal\network\utils.py", line 88, in response_chunks 87 decode_content=False, 88 File "c:\users****\appdata\local\programs\python\python37-32\lib\site-packages\pip\_vendor\urllib3\response.py", line 576, in stream 89 data = self.read(amt=amt, decode_content=decode_content) 90 File "c:\users****\appdata\local\programs\python\python37-32\lib\site-packages\pip\_vendor\urllib3\response.py", line 541, in read 91 raise IncompleteRead(self._fp_bytes_read, self.length_remaining) 92 File "c:\users\waon-pc\appdata\local\programs\python\python37-32\lib\contextlib.py", line 130, in __exit__ 93 self.gen.throw(type, value, traceback) 94 File "c:\users****\appdata\local\programs\python\python37-32\lib\site-packages\pip\_vendor\urllib3\response.py", line 443, in _error_catcher 95 raise ReadTimeoutError(self._pool, None, "Read timed out.") 96pip._vendor.urllib3.exceptions.ReadTimeoutError: HTTPSConnectionPool(host='files.pythonhosted.org', port=443): Read timed out.
おそらくキーエラーだと思うのですが、解決方法が分かりません。
※タイムアウトでした。
環境
windows10
python3.7
VS cord
> Collecting opencv--python
「opencv」と「python」の間にハイフンが二つ付いてますけど、そこはハイフン一つです
ハイフン二つ付けてpipコマンドを実行してませんか?
ハイフン1個でもやってみましたが同じエラーでした。
> socket.timeout: The read operation timed out
pipコマンドに「--no-cache-dir --default-timeout=1000」を付けてみてください
キーボード入力すると入力ミスするかもしれないので、下記をコピペしてください
pip install --upgrade opencv-python --no-cache-dir --default-timeout=1000
できました。
タイムアウトが原因だったみたいですね。
ご回答ありがとうございました。
回答2件
あなたの回答
tips
プレビュー