python-------------安装requests库时出现超时 Read timed out You are using pip version 10.0.1, however versio

错误代码:

Exception:
Traceback (most recent call last):
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37\lib\site-packages\pip\_vendor\urllib
3\response.py", line 302, in _error_catcher
    yield
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37\lib\site-packages\pip\_vendor\urllib
3\response.py", line 384, in read
    data = self._fp.read(amt)
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37\lib\site-packages\pip\_vendor\cachec
ontrol\filewrapper.py", line 60, in read
    data = self.__fp.read(amt)
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37\lib\http\client.py", line 447, in re
ad
    n = self.readinto(b)
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37\lib\http\client.py", line 491, in re
adinto
    n = self.fp.readinto(b)
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37\lib\socket.py", line 589, in readint
o
    return self._sock.recv_into(b)
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37\lib\ssl.py", line 1049, in recv_into

    return self.read(nbytes, buffer)
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37\lib\ssl.py", line 908, in read
    return 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:\Users\Administrator\AppData\Local\Programs\Python\Python37\lib\site-packages\pip\_internal\base
command.py", line 228, in main
    status = self.run(options, args)
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37\lib\site-packages\pip\_internal\comm
ands\install.py", line 291, in run
    resolver.resolve(requirement_set)
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37\lib\site-packages\pip\_internal\reso
lve.py", line 103, in resolve
    self._resolve_one(requirement_set, req)
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37\lib\site-packages\pip\_internal\reso
lve.py", line 257, in _resolve_one
    abstract_dist = self._get_abstract_dist_for(req_to_install)
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37\lib\site-packages\pip\_internal\reso
lve.py", line 210, in _get_abstract_dist_for
    self.require_hashes
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37\lib\site-packages\pip\_internal\oper
ations\prepare.py", line 310, in prepare_linked_requirement
    progress_bar=self.progress_bar
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37\lib\site-packages\pip\_internal\down
load.py", line 837, in unpack_url
    progress_bar=progress_bar
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37\lib\site-packages\pip\_internal\down
load.py", line 674, in unpack_http_url
    progress_bar)
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37\lib\site-packages\pip\_internal\down
load.py", line 898, in _download_http_url
    _download_url(resp, link, content_file, hashes, progress_bar)
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37\lib\site-packages\pip\_internal\down
load.py", line 618, in _download_url
    hashes.check_against_chunks(downloaded_chunks)
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37\lib\site-packages\pip\_internal\util
s\hashes.py", line 48, in check_against_chunks
    for chunk in chunks:
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37\lib\site-packages\pip\_internal\down
load.py", line 586, in written_chunks
    for chunk in chunks:
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37\lib\site-packages\pip\_internal\util
s\ui.py", line 159, in iter
    for x in it:
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37\lib\site-packages\pip\_internal\down
load.py", line 575, in resp_read
    decode_content=False):
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37\lib\site-packages\pip\_vendor\urllib
3\response.py", line 436, in stream
    data = self.read(amt=amt, decode_content=decode_content)
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37\lib\site-packages\pip\_vendor\urllib
3\response.py", line 401, in read
    raise IncompleteRead(self._fp_bytes_read, self.length_remaining)
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37\lib\contextlib.py", line 130, in __e
xit__
    self.gen.throw(type, value, traceback)
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37\lib\site-packages\pip\_vendor\urllib
3\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=4
43): Read timed out.
You are using pip version 10.0.1, however version 18.0 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.


系统和工具:

windows、pycharm。


解决方案:

本人试过了很多的方法去解决这个问题,

1--------当然大家首先肯定就是输入提示的这句“python -m pip install --upgrade pip'”  然后又发现装不上新版的pip。

2--------试过pip install requests -i http://pypi.douban.com/simple 也是没用

3--------试过加时间的方法pip –default-timeout=100 install -U requests也不行

4--------试过python -m pip install --user --upgrade pip这个是在install后加一个--user

5--------用管理员模式打开pycharm运行pip install requests(Linux中 sudo pip install requests)

以上这些都是我试过的方法结果都失败了。竟然会有这些方法,肯定有人成功过。所以罗列出来,希望可以帮到大家。

说来也奇怪我成功装上不是用命令行执行的。在你感觉没有办法的时候不妨换一种思路或者途径。

操作步骤如下;(前提我用的管理员模式运行的pycharm 不知道有没有关系)

1、点击文件按钮,选择设置。File------>Settings

python-------------安装requests库时出现超时 Read timed out You are using pip version 10.0.1, however versio_第1张图片

2、选择Project:******---------->Project Interpreter。

python-------------安装requests库时出现超时 Read timed out You are using pip version 10.0.1, however versio_第2张图片

3、点击有上角的绿色加号+键。

python-------------安装requests库时出现超时 Read timed out You are using pip version 10.0.1, however versio_第3张图片

4、输入requests(同理在此添加别的模块也行),后选择想要安装的模块,最后点击左下方的Install Package等待安装即可。

python-------------安装requests库时出现超时 Read timed out You are using pip version 10.0.1, however versio_第4张图片

这是我的解决方案,希望可以帮到大家!!!

 

 

你可能感兴趣的:(python-------------安装requests库时出现超时 Read timed out You are using pip version 10.0.1, however versio)