python配置和更换pip源

windows系统:

通过python的IDE找到目录,添加目录和目录下的Scripts文件夹进Path就可以在终端使用pip了

升级加更换pip源:

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

临时换源

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

Linux系统

系统默认有python

终端把上面的pip换成pip3就行

如果没有pip3就

sudo apt install python3-pip

有时候安装特别慢但中断后换源又出错的话需要手动清理缓存

  • Windows 10:C:\Users\username\AppData\Local\pip\Cache
  • macOS:/Users/username/Library/Caches/pip
  • Linux:~/.cache/pip

找到目录并删除

你可能感兴趣的:(python)