安装Pyhton版openCV时,首先要更新pip版本,运行:
python -m pip install --upgrade pip
首先报错:
λ python -m pip install --upgrade pip
Collecting pip
Downloading pip-9.0.1-py2.py3-none-any.whl (1.3MB)
79% |█████████████████████████▎ | 993kB 18kB/s eta 0:00:14Exception:
Traceback (most recent call last):
File "F:\Software_download\Anaconda\Lib\site-packages\pip\_vendor\requests\packages\urllib3\response.py", line 228, in _error_catcher
yield
File "F:\Software_download\Anaconda\Lib\site-packages\pip\_vendor\requests\packages\urllib3\response.py", line 310, in read
data = self._fp.read(amt)
File "F:\Software_download\Anaconda\Lib\site-packages\pip\_vendor\cachecontrol\filewrapper.py", line 49, in read
data = self.__fp.read(amt)
File "F:\Software_download\Anaconda\lib\http\client.py", line 448, in read
n = self.readinto(b)
File "F:\Software_download\Anaconda\lib\http\client.py", line 488, in readinto
n = self.fp.readinto(b)
File "F:\Software_download\Anaconda\lib\socket.py", line 575, in readinto
return self._sock.recv_into(b)
File "F:\Software_download\Anaconda\lib\ssl.py", line 929, in recv_into
return self.read(nbytes, buffer)
File "F:\Software_download\Anaconda\lib\ssl.py", line 791, in read
return self._sslobj.read(len, buffer)
File "F:\Software_download\Anaconda\lib\ssl.py", line 575, in read
v = 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 "F:\Software_download\Anaconda\Lib\site-packages\pip\basecommand.py", line 215, in main
status = self.run(options, args)
File "F:\Software_download\Anaconda\Lib\site-packages\pip\commands\install.py", line 310, in run
wb.build(autobuilding=True)
File "F:\Software_download\Anaconda\Lib\site-packages\pip\wheel.py", line 750, in build
self.requirement_set.prepare_files(self.finder)
File "F:\Software_download\Anaconda\Lib\site-packages\pip\req\req_set.py", line 370, in prepare_files
ignore_dependencies=self.ignore_dependencies))
File "F:\Software_download\Anaconda\Lib\site-packages\pip\req\req_set.py", line 587, in _prepare_file
session=self.session, hashes=hashes)
File "F:\Software_download\Anaconda\Lib\site-packages\pip\download.py", line 810, in unpack_url
hashes=hashes
File "F:\Software_download\Anaconda\Lib\site-packages\pip\download.py", line 649, in unpack_http_url
hashes)
File "F:\Software_download\Anaconda\Lib\site-packages\pip\download.py", line 871, in _download_http_url
_download_url(resp, link, content_file, hashes)
File "F:\Software_download\Anaconda\Lib\site-packages\pip\download.py", line 595, in _download_url
hashes.check_against_chunks(downloaded_chunks)
File "F:\Software_download\Anaconda\Lib\site-packages\pip\utils\hashes.py", line 46, in check_against_chunks
for chunk in chunks:
File "F:\Software_download\Anaconda\Lib\site-packages\pip\download.py", line 563, in written_chunks
for chunk in chunks:
File "F:\Software_download\Anaconda\Lib\site-packages\pip\utils\ui.py", line 139, in iter
for x in it:
File "F:\Software_download\Anaconda\Lib\site-packages\pip\download.py", line 552, in resp_read
decode_content=False):
File "F:\Software_download\Anaconda\Lib\site-packages\pip\_vendor\requests\packages\urllib3\response.py", line 353, in stream
data = self.read(amt=amt, decode_content=decode_content)
File "F:\Software_download\Anaconda\Lib\site-packages\pip\_vendor\requests\packages\urllib3\response.py", line 320, in read
flush_decoder = True
File "F:\Software_download\Anaconda\lib\contextlib.py", line 77, in __exit__
self.gen.throw(type, value, traceback)
File "F:\Software_download\Anaconda\Lib\site-packages\pip\_vendor\requests\packages\urllib3\response.py", line 233, in _error_catcher
raise ReadTimeoutError(self._pool, None, 'Read timed out.')
pip._vendor.requests.packages.urllib3.exceptions.ReadTimeoutError: HTTPSConnectionPool(host='pypi.python.org', port=443): Read timed out.
为了解决这个问题,在网上查找相关资料时输入:
pip --default-timeout=100 install -U pip
Cannot open D:\Program Files\Anaconda3\Scripts\pip-script.py
这个问题还是pip安装的问题,所以可以在命令行窗口(或者win+r) 输入:
easy_install pip
就可以了!