使用pip install XX 命令时报错
在使用pip命令安装的时候,我遇到这样的报错:
C:\Users\86962>pip install Appium-Python-Client Collecting Appium-Python-Client Downloading https://files.pythonhosted.org/packages/92/7e/b308cc3d94065a7491582d50343920f10ad441cab5f79ef9602f022d479f/Appium-Python-Client-0.26.tar.gz Collecting selenium>=2.47.0 (from Appium-Python-Client) Downloading https://files.pythonhosted.org/packages/41/c6/78a9a0d0150dbf43095c6f422fdf6f948e18453c5ebbf92384175b372ca2/selenium-3.13.0-py2.py3-none-any.whl (946kB) 10% |███▌ | 102kB 2.2kB/s eta 0:06:23Exception: Traceback (most recent call last): File "c:\python36\lib\site-packages\pip\_vendor\urllib3\response.py", line 302, in _error_catcher yield File "c:\python36\lib\site-packages\pip\_vendor\urllib3\response.py", line 384, in read data = self._fp.read(amt) File "c:\python36\lib\site-packages\pip\_vendor\cachecontrol\filewrapper.py", line 60, in read data = self.__fp.read(amt) File "c:\python36\lib\http\client.py", line 449, in read n = self.readinto(b) File "c:\python36\lib\http\client.py", line 493, in readinto n = self.fp.readinto(b) File "c:\python36\lib\socket.py", line 586, in readinto return self._sock.recv_into(b) File "c:\python36\lib\ssl.py", line 1009, in recv_into return self.read(nbytes, buffer) File "c:\python36\lib\ssl.py", line 871, in read return self._sslobj.read(len, buffer) File "c:\python36\lib\ssl.py", line 631, 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 "c:\python36\lib\site-packages\pip\basecommand.py", line 215, in main status = self.run(options, args) File "c:\python36\lib\site-packages\pip\commands\install.py", line 324, in run requirement_set.prepare_files(finder) File "c:\python36\lib\site-packages\pip\req\req_set.py", line 380, in prepare_files ignore_dependencies=self.ignore_dependencies)) File "c:\python36\lib\site-packages\pip\req\req_set.py", line 620, in _prepare_file session=self.session, hashes=hashes) File "c:\python36\lib\site-packages\pip\download.py", line 821, in unpack_url hashes=hashes File "c:\python36\lib\site-packages\pip\download.py", line 659, in unpack_http_url hashes) File "c:\python36\lib\site-packages\pip\download.py", line 882, in _download_http_url _download_url(resp, link, content_file, hashes) File "c:\python36\lib\site-packages\pip\download.py", line 603, in _download_url hashes.check_against_chunks(downloaded_chunks) File "c:\python36\lib\site-packages\pip\utils\hashes.py", line 46, in check_against_chunks for chunk in chunks: File "c:\python36\lib\site-packages\pip\download.py", line 571, in written_chunks for chunk in chunks: File "c:\python36\lib\site-packages\pip\utils\ui.py", line 139, in iter for x in it: File "c:\python36\lib\site-packages\pip\download.py", line 560, in resp_read decode_content=False): File "c:\python36\lib\site-packages\pip\_vendor\urllib3\response.py", line 436, in stream data = self.read(amt=amt, decode_content=decode_content) File "c:\python36\lib\site-packages\pip\_vendor\urllib3\response.py", line 401, in read raise IncompleteRead(self._fp_bytes_read, self.length_remaining) File "c:\python36\lib\contextlib.py", line 99, in __exit__ self.gen.throw(type, value, traceback) File "c:\python36\lib\site-packages\pip\_vendor\urllib3\response.py", line 307, in _error_catcher raise ReadTimeoutError(self._pool, None, 'Read timed out.') pip._vendor.urllib3.exceptions.ReadTimeoutError: HTTPSConnectionPool(host='files.pythonhosted.org', port=443): Read timed out. You are using pip version 9.0.3, however version 10.0.1 is available. You should consider upgrading via the 'python -m pip install --upgrade pip' command.
根据报错的提示:
可以知道,是因为我的pip模块的版本有点儿旧了,需要更新,所以没更新之前,它就闹罢工....
解决方法也很简单,直接在cmd命令框输入:python -m pip install --upgrade pip,然后敲回车。OK。完事儿~~
然后你就可以继续用 pip install 来愉快的安装,你所需要的模块啦~