python相关配置文件的位置
pip
通过命令行更改
以清华源为例:
临时使用:
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple some-package
设置为默认
升级 pip 到最新的版本 (>=10.0.0) 后进行配置:
python -m pip install -i https://pypi.tuna.tsinghua.edu.cn/simple --upgrade pip
python -m pip install --upgrade pip
pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple
Linux
# 如果找不到,则推荐在 ~/.pip/pip.conf 路径创建 pip.conf 文件
/etc/pip.con
~/.pip/pip.conf
~/.config/pip/pip.conf
window
%APPDATA%\pip\pip.ini
%HOME%\pip\pip.ini
C:\Documents and Settings\All Users\Application Data\PyPA\pip\pip.conf (Windows XP)
C:\ProgramData\PyPA\pip\pip.conf (Windows 7及以后)
MAC
~/Library/Application Support/pip/pip.conf
~/.pip/pip.conf
/Library/Application Support/pip/pip.conf