使用pip时的一些问题

问题1:WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by ‘SSLError(SSLError(1, ‘[SSL: WRONG_VERSION_NUMBER] wrong version number (_ssl.c:1124)’))’: /simple/mitmproxy/

pip安装应用时报错pip3 install mitmproxy

  • 报错信息:
(venv) D:\PycharmProjects\pythonProject>pip3 install mitmproxy
WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLError(1, '[SSL: WRONG_VERSION_NUMBER] w
rong version number (_ssl.c:1124)'))': /simple/mitmproxy/
WARNING: Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLError(1, '[SSL: WRONG_VERSION_NUMBER] w
rong version number (_ssl.c:1124)'))': /simple/mitmproxy/
WARNING: Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLError(1, '[SSL: WRONG_VERSION_NUMBER] w
rong version number (_ssl.c:1124)'))': /simple/mitmproxy/
WARNING: Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLError(1, '[SSL: WRONG_VERSION_NUMBER] w
rong version number (_ssl.c:1124)'))': /simple/mitmproxy/
WARNING: Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLError(1, '[SSL: WRONG_VERSION_NUMBER] w
rong version number (_ssl.c:1124)'))': /simple/mitmproxy/
Could not fetch URL https://pypi.org/simple/mitmproxy/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='pypi.org', port=443): Max retries
 exceeded with url: /simple/mitmproxy/ (Caused by SSLError(SSLError(1, '[SSL: WRONG_VERSION_NUMBER] wrong version number (_ssl.c:1124)'))) - skipping
ERROR: Could not find a version that satisfies the requirement mitmproxy
ERROR: No matching distribution found for mitmproxy
Could not fetch URL https://pypi.org/simple/pip/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='pypi.org', port=443): Max retries excee
ded with url: /simple/pip/ (Caused by SSLError(SSLError(1, '[SSL: WRONG_VERSION_NUMBER] wrong version number (_ssl.c:1124)'))) - skipping

(venv) D:\PycharmProjects\pythonProject>
(venv) D:\PycharmProjects\pythonProject>
  • 方法1:在C盘目录C:\Users\admin\AppData\Roaming\pip文件夹创建pip.ini文件,同時在pip.ini文件中输入一下内容即可,在此文件中修改了pip下载源,同时指定新的下载源和域名。
[global]
index-url = http://mirrors.aliyun.com/pypi/simple
trusted-host = http://mirrors.aliyun.com
  • 方法2:在pip install xxx指令后边添加-i http://pypi.douban.com/simple --trusted-host pypi.douban.com(其中的xxx是你需要下载的包)
(venv) D:\PycharmProjects\pythonProject>pip install pyserial -i http://pypi.douban.com/simple --trusted-host pypi.douban.com
Looking in indexes: http://pypi.douban.com/simple
Collecting pyserial
  Downloading http://pypi.doubanio.com/packages/07/bc/587a445451b253b285629263eb51c2d8e9bcea4fc97826266d186f96f558/pyserial-3.5-py2.py3-none-any.whl (90 kB)
     |████████████████████████████████| 90 kB 990 kB/s
Installing collected packages: pyserial
Successfully installed pyserial-3.5
WARNING: You are using pip version 20.3.1; however, version 21.0.1 is available.
You should consider upgrading via the 'd:\pycharmprojects\pythonproject\venv\scripts\python.exe -m pip install --upgrade pip' command.
(venv) D:\PycharmProjects\pythonProject>

附上pip国内源:

阿里云 http://mirrors.aliyun.com/pypi/simple/
中国科技大学 https://pypi.mirrors.ustc.edu.cn/simple/
豆瓣(douban) http://pypi.douban.com/simple/
清华大学 https://pypi.tuna.tsinghua.edu.cn/simple/
使用方法:在后面直接 -i 加 url

pip install 包名.whl -i http://pypi.mirrors.ustc.edu.cn/simple -trusted-host pypi.mirrors.ustc.edu.cn

参考:
https://blog.csdn.net/lsf_007/article/details/87931823
https://blog.csdn.net/weixin_41010294/article/details/103672386
https://www.it610.com/article/1280565051354267648.htm

问题2:WARNING: You are using pip version 20.3.1; however, version 21.0.1 is available.

解决:

(venv) D:\PycharmProjects\pythonProject>python -m pip install --upgrade pip  --trusted-host mirrors.aliyun.com
Looking in indexes: http://mirrors.aliyun.com/pypi/simple
Requirement already satisfied: pip in d:\pycharmprojects\pythonproject\venv\lib\site-packages (20.3.1)
Collecting pip
  Downloading http://mirrors.aliyun.com/pypi/packages/fe/ef/60d7ba03b5c442309ef42e7d69959f73aacccd0d86008362a681c4698e83/pip-21.0.1-py3-none-any.whl (1.5 MB)
     |████████████████████████████████| 1.5 MB 6.8 MB/s
Installing collected packages: pip
  Attempting uninstall: pip
    Found existing installation: pip 20.3.1
    Uninstalling pip-20.3.1:
      Successfully uninstalled pip-20.3.1
Successfully installed pip-21.0.1

(venv) D:\PycharmProjects\pythonProject>
  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值