【Python】pip全局更换国内镜像源(Windows & macOS)


✨pip

pip is the package installer for Python. You can use pip to install packages from the Python Package Index and other indexes.

pip · PyPI


✨pip国内镜像源

阿里云
https://mirrors.aliyun.com/pypi/simple/

中科大
https://pypi.mirrors.ustc.edu.cn/simple/

清华
https://pypi.tuna.tsinghua.edu.cn/simple/

豆瓣
https://pypi.douban.com/simple/

注意所有源已经全都更新为https


✨pip全局更换国内镜像源

Windows

pip config list -v

当前用户的pip配置文件为C:\Users\${username}\pip\pip.ini

我们把当前用户下的pip源更换为国内源


进入C:\Users\${username}\

新建文件夹pip

新建pip.ini

内容如下(更换为阿里云的源,根据需要自行更改)

[global]
index-url=https://mirrors.aliyun.com/pypi/simple/
[install]
trusted-host=mirrors.aliyun.com

再次运行pip config list -v

更换源成功。


macOS

pip config list -v

当前用户的pip配置文件为/Users/${username}/.pip/pip.conf

我们把当前用户下的pip源更换为国内源

cd ~
mkdir .pip
cd .pip
vim pip.conf

内容如下(更换为阿里云的源,根据需要自行更改)

[global]
index-url=https://mirrors.aliyun.com/pypi/simple/
[install]
trusted-host=mirrors.aliyun.com

再次运行pip config list -v

更换源成功。


⭐转载请注明出处

本文作者:双份浓缩馥芮白

原文链接:https://www.cnblogs.com/Flat-White/p/15705938.html

版权所有,如需转载请注明出处。


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM