pip 修改国内源

参考

注意

本文将pip源永久切换为清华源,测试可用。其他源未测试,请自主测试。

环境

环境 版本 说明
Windows Windows 10 专业版 22H2 19045.4170
VS Code 1.88.1
Python 3.12
pip 3.12
git命令客户端 2.43.0.windows.1

正文

将 xxxx 换成需要安装的包的名字

  1. 临时换源:
    • 清华源 pip install xxxx -i https://pypi.tuna.tsinghua.edu.cn/simple
    • 阿里源 pip install xxxx -i https://mirrors.aliyun.com/pypi/simple/
    • 腾讯源 pip install xxxx -i http://mirrors.cloud.tencent.com/pypi/simple
    • 豆瓣源 pip install xxxx -i http://pypi.douban.com/simple/
  2. 永久换源:
    • 清华源 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/
  3. 换回默认源
    pip config unset global.index-url
posted @ 2024-04-13 10:30  夏秋初  阅读(188)  评论(0)    收藏  举报