pip设置国内镜像源
时间: 2024-10-28 09:01:04 浏览: 77
pip是一个Python包管理工具,用于安装、升级和卸载Python软件包。如果你想在国内访问速度较快的情况下使用pip下载包,可以设置国内镜像源。以下是设置国内镜像源的步骤:
1. **阿里云PyPI镜像**:
- 打开终端或者命令提示符,输入以下命令:
```
pip config set global.index- 如果需要保存设置,添加`--global`选项:
```
pip config set global.index-url https://mirrors.aliyun.com/pypi/simple/ --global
```
2. **清华大学开源中国镜像**:
- 同样地,在终端中运行:
```
pip config set global.index-url http://pypi.mirrors.ustc.edu.cn/simple/
```
或者加上`--global`标志。
3. **更换为中国科技大学镜像**:
```
pip config set global.index-url http://pypi.douban.com/simple/
```
4. **验证镜像是否有效**:
```
pip list --index-url=https://mirrors.aliyun.com/pypi/simple/
```
记住,每次更新pip时,可能需要再次设置镜像源。如果上述操作后仍无法正常使用,可能是因为网络限制或镜像源本身的问题。这时你可以尝试其他国内镜像源,如豆瓣、中科大等。
阅读全文
相关推荐


















