环境配置·

window清除pip的镜像的办法2025

首发于 博客园原文链接

本篇目录3 节
开发环境就不应该搞什么镜像,有各种下载速度和版本问题,搞个梯子才是最好的选择
  1. Using the pip config command
  1. Editing the pip.conf file directly
To change the trusted-host setting, use one of these methods:

Method 1: Using pip config command#

pip config set global.trusted-host pypi.tuna.tsinghua.edu.cn
Or to set multiple trusted hosts:
pip config set global.trusted-host "pypi.tuna.tsinghua.edu.cn mirrors.aliyun.com"

Method 2: Edit pip.ini directly#

The configuration file is typically located at:
  • %APPDATA%pippip.ini on Windows
  • ~/.config/pip/pip.conf on Linux/Mac
You can edit it to include:
[global] trusted-host = pypi.tuna.tsinghua.edu.cn

To remove a setting:#

pip config unset global.trusted-host
Note that in your original attempts, you were trying to use the settings as if they were commands, which is why you got "unknown command" errors. The correct approach is to use pip config set or pip config unset as shown above.

评论加载中…