0
点赞
收藏
分享

微信扫一扫

【Python】pip 换源

爱情锦囊 2022-02-23 阅读 286
pythonpip

Python 使用 pip 下载 “包” 默认使用官方的下载源,服务器在国外,国内下载一般比较慢,可以更换国内下载源解决。

一、源

二、临时更换

pip install 包名 –i http://pypi.douban.com/simple/ --trusted-host pypi.douban.com

三、永久方法

1、win + r 输入 %USERPROFILE% 进入用户文件夹(C:\User\用户名)
2、打开 pip 文件夹(没有则创建)打开 pip.ini 文件(没有则创建)
3、输入如下内容并保存

[global]
index-url=http://pypi.douban.com/simple/
trusted-host=pypi.douban.com

文件路径“C:\Users\用户名\pip\pip.ini”

四、常见问题

1、域名不可信

WARNING: The repository located at pypi.douban.com is not a trusted or secure host and is being ignored. If this repository is available via HTTPS we recommend you use HTTPS instead, otherwise you may silence this warning and allow it anyway with '--trusted-host pypi.douban.com'.
解决方式:
文件则加上 trusted-host=镜像站域名
临时则加上 --trusted-host 域名

举报

相关推荐

0 条评论