若要把 pip 源换成国内的,只需要把上面的代码改成下图这样(下图以清华大学源为例):
pip install markdown -i https://pypi.tuna.tsinghua.edu.cn/simple
这样我们就从清华大学源成功安装了markdown模块,速度会比过pip默认的国外源快很多。
上述做法是临时改成国内源,如果不想每次用 pip 都加上 -i https://pypi.tuna.tsinghua.edu.cn/simple,那么可以把国内源设为默认,做法是:
清华源
pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple
或:
阿里源
pip config set global.index-url https://mirrors.aliyun.com/pypi/simple/
腾讯源
pip config set global.index-url http://mirrors.cloud.tencent.com/pypi/simple
豆瓣源
pip config set global.index-url http://pypi.douban.com/simple/
general configuration parameters
python -m pip config [ python -m pip config [
python -m pip config [
python -m pip config [
python -m pip config [
python -m pip config [