Python 安装第三方库

Posted Arvin_JIN

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Python 安装第三方库相关的知识,希望对你有一定的参考价值。

cmd进入Python安装路径scripts文件夹

>pip install requests

报错:

Collecting requests
Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by \'SSLError(SSLError(1, \'[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:777)\'),)\': /simple/requests/
Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by \'SSLError(SSLError(1, \'[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:777)\'),)\': /simple/requests/
Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by \'SSLError(SSLError(1, \'[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:777)\'),)\': /simple/requests/
Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by \'SSLError(SSLError(1, \'[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:777)\'),)\': /simple/requests/
Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by \'SSLError(SSLError(1, \'[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:777)\'),)\': /simple/requests/
Could not fetch URL https://pypi.python.org/simple/requests/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host=\'pypi.python.org\', port=443): Max retries exceeded with url: /simple/requests/ (Caused by SSLError(SSLError(1, \'[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:777)\'),)) - skipping
Could not find a version that satisfies the requirement requests (from versions: )

原因:查找网上的解释是网速太慢,或被墙了。

解决办法:使用国内镜像加速。

>pip install requests -i http://pypi.douban.com/simple/ --trusted-host pypi.douban.com

问题解决。

 

以上是关于Python 安装第三方库的主要内容,如果未能解决你的问题,请参考以下文章

python第三方库如何安装?

python第三方库安装到哪里

如何在安装pip3以及第三方python库

VS Code中安装python、第三方库

如何在安装pip3以及第三方python库

如何查看Python3安装及第三方库路径