Python2.7中升级安装pip失败的解决方法:(亲测有效)(使用whl文件进行python模块的安装)

错误内容为:

Exception:
Traceback (most recent call last):
  File "D:\Python27\lib\site-packages\pip\basecommand.py", line 211, in main
    status = self.run(options, args)
  File "D:\Python27\lib\site-packages\pip\commands\install.py", line 294, in run
    requirement_set.prepare_files(finder)
  File "D:\Python27\lib\site-packages\pip\req\req_set.py", line 334, in prepare_files
    functools.partial(self._prepare_file, finder))
  File "D:\Python27\lib\site-packages\pip\req\req_set.py", line 321, in _walk_req_to_install
    more_reqs = handler(req_to_install)
  File "D:\Python27\lib\site-packages\pip\req\req_set.py", line 491, in _prepare_file
    session=self.session)
  File "D:\Python27\lib\site-packages\pip\download.py", line 825, in unpack_url
    session,
  File "D:\Python27\lib\site-packages\pip\download.py", line 673, in unpack_http_url
    from_path, content_type = _download_http_url(link, session, temp_dir)
  File "D:\Python27\lib\site-packages\pip\download.py", line 857, in _download_http_url
    stream=True,
  File "D:\Python27\lib\site-packages\pip\_vendor\requests\sessions.py", line 477, in get
    return self.request('GET', url, **kwargs)
  File "D:\Python27\lib\site-packages\pip\download.py", line 373, in request
    return super(PipSession, self).request(method, url, *args, **kwargs)
  File "D:\Python27\lib\site-packages\pip\_vendor\requests\sessions.py", line 465, in request
    resp = self.send(prep, **send_kwargs)
  File "D:\Python27\lib\site-packages\pip\_vendor\requests\sessions.py", line 573, in send
    r = adapter.send(request, **kwargs)
  File "D:\Python27\lib\site-packages\pip\_vendor\cachecontrol\adapter.py", line 46, in send
    resp = super(CacheControlAdapter, self).send(request, **kw)
  File "D:\Python27\lib\site-packages\pip\_vendor\requests\adapters.py", line 419, in send
    raise ConnectTimeout(e, request=request)

之后的处理方法为:

1、从https://pypi.org/project/pip/10.0.1/#files下载最新版的pip(10.0.1)其中的压缩包即:pip-10.0.1.tar.gz

Python2.7中升级安装pip失败的解决方法:(亲测有效)(使用whl文件进行python模块的安装)_第1张图片

2、选择该文件,点击下载到本地,然后解压到python的安装目录下的Scripts文件夹下。

3、使用cmd命令行到达该文件夹目录中。

        1.按下:“win+R”;    

        2.输入“cmd”;    

        3.输入“d:”,跳转到d:盘中;

        4.输入“cd”+“python安装目录”。

            我这里使用的目录是:“cd Python27\Scripts\pip-10.0.1”然后点击回车。

            可以使用“dir”查看目录下的文件详细信息。

  )

4、使用python setup.py build    +    python setup.py install 即可安装升级pip成功。

(此处如果失败。可以尝试将python安装目录下的python.exe 文件改名为 python2.exe   ,,: 然后回到第四步,将python换成python2进行安装即可)。

 

为未来干杯,我们一同进步。谢谢你们看了我的文章。

2018.6.15更新:

    :如果在其中发现了pip安装时可能出现失误,这时我们可以从网上下载python的模块到本地的python安装路径下的Scripts文件夹中,然后使用命令:pip install + 下载的.whl的文件进行安装。

网址如下:https://www.lfd.uci.edu/~gohlke/pythonlibs/

也可以通过官网进行模块的查找的下载安装:https://pypi.org/

你可能感兴趣的:(Python2.7中升级安装pip失败的解决方法:(亲测有效)(使用whl文件进行python模块的安装))