首页 > Python > 解决pip下载失败的问题

解决pip下载失败的问题

Python 2023-10-11

pip下载不成功的原因大概就是网速原因,最简单的方法就是更换源

# 清华源
pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple

# 阿里源
pip config set global.index-url https://mirrors.aliyun.com/pypi/simple/

# 腾讯源
pip config set global.index-url http://mirrors.cloud.tencent.com/pypi/simple

# 豆瓣源
pip config set global.index-url http://pypi.douban.com/simple/

这样就可以解决大多数pip因为网速下载失败的问题 你同样也可以直接前往对应的官网下载对应的whl文件安装也行 这里我们前往清华源https://mirrors.tuna.tsinghua.edu.cn/pypi/web/simple/ 在链接后加上你要安装的包名,我这里下载opencv就是 https://mirrors.tuna.tsinghua.edu.cn/pypi/web/simple/opencv-python/ 找到对应的版本下载


最后使用pip安装下载的whl文件就可以实现离线安装

pip install 文件名.whl