安装pip
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py # 下载安装脚本
sudo python get-pip.py # 运行安装脚本
命令行使用
pip --version
pip search packagename
pip install packagename
pip install -U packagename
pip install packagename==version
pip uninstall package
Python脚本中使用
from pip._internal import main
main(['search', 'packagename'])
main(['install', 'packagename'])
main(['install', '-U', 'packagename'])
配置镜像源
# vi ~/.pip/pip.conf
[global]
trusted-host = mirrors.aliyun.com
index-url = https://mirrors.aliyun.com/pypi/simple