pip install改下载路径及换源

3,616 阅读1分钟

更改pip默认安装路径

  1. python安装路径下Lib文件夹中用记事本打开site.py
  2. USER_SITE = NoneUSER_BASE = None分别改为如下代码并保存
USER_SITE = "C:\\app\\Python37\\Lib\\site-packages"
USER_BASE = "C:\\app"
  1. 查看路径配置
python -m site

pip install 本地whl

pip install filename

如:

pip install C:\Users\fpp\Desktop\numpy-1.16.4+mkl-cp37-cp37m-win_amd64.whl

pip 换源

参考帮助文档
临时换源下载:

pip install -i https://pypi.tuna.tsinghua.edu.cn/simple some-package

永久换源: (先用临时源升级pip到最新版本)

python -m pip install --upgrade pip -i https://pypi.tuna.tsinghua.edu.cn/simple
pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple

其他源:

清华 https://pypi.tuna.tsinghua.edu.cn/simple
中科大 https://pypi.mirrors.ustc.edu.cn/simple
阿里云 http://mirrors.aliyun.com/pypi/simple
豆瓣 http://pypi.douban.com/simple