pip 命令简介

pip 简介

pip 是 Python中的标准管理器,它允许安装和管理不属于Python标准库的其它软件包(第三方库);

pip 简单操作

windows Win+r 输入 cmd 回车

pip 常用命令

查看 pip 路径

C:\Users\admin>where pip
D:\tool\python3.8\Scripts\pip.exe

查看 pip 版本

C:\Users\admin>pip -V
pip 19.2.3 from d:\tool\python3.8\lib\site-packages\pip (python 3.8)

pip 升级版本

python -m pip install -upgrade pip

安装第三方库

已安装 numpy为例

方式一

pip install numpy

方式二

pip install numpy -i https://mirrors.aliyun.com/pypi/simple/

这样指定国内镜像地址会快很多,国内也有其它镜像地址供使用

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

方式三

指定版本号

pip install numpy=0.123

其它命令

设置全局镜像地址

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

卸载

pip uninstall package_name #这里的package_name是要卸载的第三方库名

更新指定包

pip install --upgrade package_name

 

posted @ 2023-06-11 09:12  晓枫的春天  阅读(43)  评论(0编辑  收藏  举报