[python学习]pip 部分操作
import os
#常用国内镜像源
#阿里云http://mirrors.aliyun.com/pypi/simple/
#中国科技大学https://pypi.mirrors.ustc.edu.cn/simple/
#豆瓣http://pypi.douban.com/simple
#中国科学院http://pypi.mirrors.opencas.cn/simple/
#清华大学https://pypi.tuna.tsinghua.edu.cn/simple/
need_lib ="dingtalk-sdk" #包名
image_source ='https://pypi.douban.com/simple' #镜像源
# cmd = f"pip install -U pip" #升级pip
# cmd = f"pip install {need_lib}" #安装包
# cmd = f"pip install {need_lib} -i {image_source}" #镜像源安装包
# cmd = f"pip uninstall {need_lib}" #移除包
# cmd = f"pip install --upgrade {need_lib}" #升级包
# cmd = f"pip install --upgrade {need_lib} -i {image_source}" #升级包
cmd =f"pip search {need_lib}" #搜索包
# cmd = f"pip show {need_lib}" #显示安装包信息
# cmd = "pip list" #列出已安装的包
# cmd = "pip list -o" #查看可升级的包
# cmd = "pip -h"
os.system(cmd)