【Python】pip 下载第三方库失败 (已解决)

最重要的是 确保连的WIFI不是公司的网络!!!要连自己的手机热点;

问题描述:

当在命令窗口(Win+cmd)用pip install librosa 指令 想下载第三方库的时候,一直失败;

总而言之,在原指令的后面再加上:

-i https://pypi.tuna.tsinghua.edu.cn/simple pip --trusted-host pypi.tuna.tsinghua.edu.cn

就可以;

更新pip也是同理,指令为:

pip install --upgrade pip -i https://pypi.tuna.tsinghua.edu.cn/simple pip --trusted-host pypi.tuna.tsinghua.edu.cn

报错信息:

指令:pip install librosa

C:\Users\na.chen>pip install librosa

WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate in certificate chain (_ssl.c:997)'))': /simple/librosa/

WARNING: Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate in certificate chain (_ssl.c:997)'))': /simple/librosa/

WARNING: Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate in certificate chain (_ssl.c:997)'))': /simple/librosa/

WARNING: Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate in certificate chain (_ssl.c:997)'))': /simple/librosa/

WARNING: Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate in certificate chain (_ssl.c:997)'))': /simple/librosa/

Could not fetch URL https://pypi.org/simple/librosa/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='pypi.org', port=443): Max retries exceeded with url: /simple/librosa/ (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate in certificate chain (_ssl.c:997)'))) - skipping

ERROR: Could not find a version that satisfies the requirement librosa (from versions: none)

ERROR: No matching distribution found for librosa

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 exceeded with url: /simple/pip/ (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate in certificate chain (_ssl.c:997)'))) - skipping

WARNING: There was an error checking the latest version of pip.

图片截图:

解决方法:

指令改成:

pip install librosa -i https://pypi.tuna.tsinghua.edu.cn/simple pip --trusted-host pypi.tuna.tsinghua.edu.cn

C:\Users\na.chen>pip install librosa -i https://pypi.tuna.tsinghua.edu.cn/simple pip --trusted-host pypi.tuna.tsinghua.edu.cn
Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple
Collecting librosa
  Downloading https://pypi.tuna.tsinghua.edu.cn/packages/e4/1c/23ef2fd02913d65d43dc7516fc829af709314a66c6f0bdc2e361fdcecc2d/librosa-0.9.2-py3-none-any.whl (214 kB)
     ---------------------------------------- 214.3/214.3 kB 687.1 kB/s eta 0:00:00
Requirement already satisfied: pip in c:\program files\windowsapps\pythonsoftwarefoundation.python.3.10_3.10.2800.0_x64__qbz5n2kfra8p0\lib\site-packages (22.3.1)
Collecting packaging>=20.0
  Downloading https://pypi.tuna.tsinghua.edu.cn/packages/ed/35/a31aed2993e398f6b09a790a181a7927eb14610ee8bbf02dc14d31677f1c/packaging-23.0-py3-none-any.whl (42 kB)
     ---------------------------------------- 42.7/42.7 kB 514.9 kB/s eta 0:00:00
Collecting numpy>=1.17.0
  Using cached https://pypi.tuna.tsinghua.edu.cn/packages/fa/df/53e8c0c8ccecf360b827a3d2b1b6060644c635c3149a9d6415a6fe4ccf44/numpy-1.24.2-cp310-cp310-win_amd64.whl (14.8 MB)
Collecting resampy>=0.2.2
  Downloading https://pypi.tuna.tsinghua.edu.cn/packages/f2/d3/5209fd2132452f199b1ddf0d084f9fd5f5f910840e3b282f005b48a503e1/resampy-0.4.2-py3-none-any.whl (3.1 MB)
     ---------------------------------------- 3.1/3.1 MB 925.5 kB/s eta 0:00:00
Collecting scipy>=1.2.0
  Downloading https://pypi.tuna.tsinghua.edu.cn/packages/ec/97/719e7c5b5081524b056652eec1e31c08a54f262f00dae62089094bde66b3/scipy-1.10.0-cp310-cp310-win_amd64.whl (42.5 MB)
     ---------------------------------------- 42.5/42.5 MB 88.9 kB/s eta 0:00:00
Collecting joblib>=0.14
  Downloading https://pypi.tuna.tsinghua.edu.cn/packages/91/d4/3b4c8e5a30604df4c7518c562d4bf0502f2fa29221459226e140cf846512/joblib-1.2.0-py3-none-any.whl (297 kB)
     ---------------------------------------- 298.0/298.0 kB 52.2 kB/s eta 0:00:00

最后成功的截图:

  • 7
    点赞
  • 21
    收藏
    觉得还不错? 一键收藏
  • 2
    评论
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值