--- notion-id: dcf43e91-808c-4469-8466-81ebfc0b2d42 --- python 设置源及查看方法: ```shell # 查看设置 python -m pip config list # 设置源 python -m pip config set global.index-url 'http://mirrors.aliyun.com/pypi/simple/' # 设置信任镜像 python -m pip config set install.trusted-host 'mirrors.aliyun.com' ``` 成功解决(pip提示升级):WARNING: There was an error checking the latest version of pip. > [!note]+ 任选一种即可: > 解决方法1: > ```shell > python.exe -m pip install --upgrade pip > 解决方法2: > ``` > ```shell > python -m pip install --upgrade pip > ``` > 解决方法3: > ```shell > pip install --upgrade pip > ``` > 解决方法4: > ```shell > python3 -m pip install --upgrade pip > ``` > 解决方法5: > ```shell > python -m pip install -U --force-reinstall pip > ``` **pip设置国内源** ```shell 阿里云 http://mirrors.aliyun.com/pypi/simple/ 中国科技大学 https://pypi.mirrors.ustc.edu.cn/simple/ 豆瓣(douban) http://pypi.douban.com/simple/ 清华大学 https://pypi.tuna.tsinghua.edu.cn/simple/ 中国科学技术大学 http://pypi.mirrors.ustc.edu.cn/simple/ ``` ## **单独使用** ```plain text 以PyQt5为例,在后面加 -i 源链接 pip install PyQt5 -i http://pypi.douban.com/simple/ ``` ## 全局**使用** ```shell 因个人工作环境是Windows,所以这里设置的也是Windows C盘 User 文件夹下创建 pip文件夹 新建文件 pip.ini 内容如下:以设置豆瓣源为例 C:\Users\SL\AppData\Roaming\pip [global] index-url = http://mirrors.aliyun.com/pypi/simple/ [install] trusted-host = mirrors.aliyun.com 设置好后,安装第三方库时,只需 pip install 指定库 即可使用豆瓣源下载安装 ```