一 Python pip 常用语法

PiP常用语法

基础使用语法

普通安装 pip install requests
指定版本安装 pip install robotframework==2.8.7
卸载已安装的库 pip uninstall requests
列出已经安装的库 pip list pip freeze
将已经安装的库列表保存到文本文件中 pip freeze > D:\桌面\install.txt
根据依赖文件批量安装库 pip install -r install.txt
显示所安装包的信息 pip show package pip show -f package
升级指定的包 pip install -U package

库的安装

wheel文件安装方法

  1. 下载wheel文件
    (网址:https://www.lfd.uci.edu/~gohlke/pythonlibs/#twisted)
    2.选择自己需要的库,注意与自己python版本匹配和系统
    3.安装
    安装命令:
    使用pip install pillow-4.2xxxxxxx.whl的方式离线进行安装

换源安装

国内的换源网址:
  1. 阿里云 http://mirrors.aliyun.com/pypi/simple/
  2. 中国科技大学 https://pypi.mirrors.ustc.edu.cn/simple/
  3. 豆瓣(douban) https://pypi.douban.com/simple/
  4. 清华大学 https://pypi.tuna.tsinghua.edu.cn/simple/
  5. 中国科学技术大学 http://pypi.mirrors.ustc.edu.cn/simple/
安装:
  1. 临时安装,
    示例:
    pip install requests -i https://pypi.tuna.tsinghua.edu.cn/simple(换源网址)

  2. 换源安装:
    1.点击此电脑,在最上面的的文件夹窗口输入 : %APPDATA%
    2.按回车跳转到以下目录,新建pip文件夹
    3.创建pip.ini文件
    4.打开文件夹,输入以下内容,关闭即可(注意:源镜像可替换)
    [global]
    timeout = 6000
    index-url = https://pypi.tuna.tsinghua.edu.cn/simple trusted-host = pypi.tuna.tsinghua.edu.cn

  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值