【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