connection broken by ‘ProtocolError(‘Connection aborted.‘, FileNotFoundError导致安装失败

#问题描述#

使用pip安装模块时总是失败并显示无法连接:

pip3 install selenium --log aa
WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProtocolError('Connection aborted.', FileNotFoundError(2, 'No such file or directory'))': /simple/selenium/
WARNING: Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProtocolError('Connection aborted.', FileNotFoundError(2, 'No such file or directory'))': /simple/selenium/
WARNING: Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProtocolError('Connection aborted.', FileNotFoundError(2, 'No such file or directory'))': /simple/selenium/
WARNING: Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProtocolError('Connection aborted.', FileNotFoundError(2, 'No such file or directory'))': /simple/selenium/
WARNING: Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProtocolError('Connection aborted.', FileNotFoundError(2, 'No such file or directory'))': /simple/selenium/
ERROR: Could not find a version that satisfies the requirement selenium (from versions: none)
ERROR: No matching distribution found for selenium

网上也有很多解决方案,比如:

.升级pip

.升级python

.设置其他源

.修改pip_ini配置文件

这些都不能解决该问题,但错误信息中以及日志中都没有指向很明确的提示

#问题调查#

pip search selenium
ERROR: Exception:
Traceback (most recent call last):
  File "C:\Program Files\Python3\lib\site-packages\pip\_vendor\urllib3\connectionpool.py", line 714, in urlopen
    httplib_response = self._make_request(
  File "C:\Program Files\Python3\lib\site-packages\pip\_vendor\urllib3\connectionpool.py", line 403, in _make_request
    self._validate_conn(conn)
  File "C:\Program Files\Python3\lib\site-packages\pip\_vendor\urllib3\connectionpool.py", line 1053, in _validate_conn
    conn.connect()
  File "C:\Program Files\Python3\lib\site-packages\pip\_vendor\urllib3\connection.py", line 400, in connect
    self.ssl_context = create_urllib3_context(
  File "C:\Program Files\Python3\lib\site-packages\pip\_vendor\urllib3\util\ssl_.py", line 350, in create_urllib3_context
    context.keylog_filename = sslkeylogfile
FileNotFoundError: [Errno 2] No such file or directory: 'D:\\keyfile\\tempsslkey.log'

During handling of the above exception, another exception occurred:

最后发现当执行search操作时,提示语就很明确,原来是因为缺少tempsslkey.log文件导致https的源无法连接

#问题解决#

在提示语指明的路径中新建缺少的文件,重新执行安装操作,一切正常

pip install命令的提示语不明确,可以加上--log选项输出更加的详细日志,如果提示语依然不明确,可以切换其他选项,直到找到明确提示语为止

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值