摘要:我们为何要应用requirements.txt呢? 首要应用目标: 任何 运用顺序 平常 须要设置装置 所需并 依附 一组类库去知足 事情请求 。 请求 文件 是 指定 战 一次性 装置 包 的 依附项 详细]

我们为什么要使用requirements.txt呢?

主要使用目的:任何应用程序通常需要设置安装所需并依赖一组类库来满足工作要求。要求文件是指定和一次性安装包的依赖项具体一整套方法。

requirements.txt文件格式:

requests==1.2.0 Flask==0.10.1

方法一:

$ pip freeze > requirements.txt

查看源文件

pip的freeze命令用于生成将当前项目的pip类库列表生成 requirements.txt 文件:

如果要安装requirements.txt中的类库内容,那么你可以执行pip install -r requirements.txt.

方法二:

$ pip

使用 pipreqs — — pipreqs 用于生成 requirements.txt 文件可以根据需要导入的任何项目

为什么不使用pip的Freeze命令呢?

pip的freeze命令保存了保存当前Python环境下所有类库包,其它包括那些你没有在当前项目中使用的类库。 (如果你没有的virtualenv)。

pip的freeze命令只保存与安装在您的环境python所有软件包。

但有时你只想将当前项目使用的类库导出生成为 requirements.txt;

使用方法:

$ pip install pipreqs $ pipreqs /path/to/project

查看源文件

其他选项详见https://github.com/bndr/pipreqs

Python使用requirements.txt安装类库的更多相关文章

  1. Python 生成requirement 使用requirements.txt安装类库

    快速生成requirement.txt的安装文件 (CenterDesigner) xinghe@xinghe:~/PycharmProjects/CenterDesigner$ pip freeze ...

  2. linux和windows下安装python拓展包及requirement.txt安装类库

    python拓展包安装 直接安装拓展包默认路径: Unix(Linux)默认路径:/usr/local/lib/pythonX.Y/site-packagesWindows默认路径:C:\Python ...

  3. python使用 requirements.txt 管理所需的包

    使用 requirements.txt 管理所需的包 2019/01/28 作者 若要与其他人共享项目.使用生成系统,或打算将项目复制到需要在其中还原环境的其他任何位置,必须指定项目需要的外部包. 建 ...

  4. Python生成requirements.txt包依赖管理文件

    requirements.txt是Python的依赖管理软件,和Java的POM一样. requirements.txt会生成使用了pip安装后的依赖包,在正常环境下会生成这个目录下的包/usr/lo ...

  5. Python生成requirements.txt方法

    在查看别人的Python项目时,经常会看到一个requirements.txt文件,里面记录了当前程序的所有依赖包及版本号,其作用是用来在另一个环境上重新构建项目所需要的运行环境依赖. require ...

  6. python生成requirements.txt 导出项目依赖

    使用pip freeze $ pip freeze > requirements.txt 这种方式是把整个环境中的包都列出来了,如果是虚拟环境可以使用. 通常情况下我们只需要导出当前项目的req ...

  7. python 生成requirements.txt

    生成requirements.txt文件 pip freeze > requirements.txt 安装requirements.txt依赖 pip install -r requiremen ...

  8. pip通过requirements.txt安装依赖

    pip install -t . -r requirements.txt requirements.txt Keras==2.0.8 gensim torchvision opencv-python ...

  9. pip install -r requirements.txt 安装mysqldb失败 解决方案

    在pip.log中出现sh: 1: mysql_config: not found等一坨报错,因为没有安装另一个包: 只要原因是没有安装:libmysqlclient-dev sudo apt-get ...

随机推荐

  1. 《OpenGL游戏编程》第9章-PlanarShadow关键代码注释

    阴影这块确实是难点.说到阴影就必须提到投影矩阵.模板值为1和2时分别渲染.说来话长,仅仅放上代码,供日后查阅. /** 渲染墙面和阴影 */ void CPlanarShadow::Render() ...

  2. java.io.DataInput接口和java.io.DataOutput接口详解

    public interface DataInput DataInput 接口用于从二进制流中读取字节,并重构所有 Java 基本类型数据.同时还提供根据 UTF-8 修改版格式的数据重构 Strin ...

  3. URL 中#号,? ,&的作用 (摘抄整理 链接为学习地址)

    1. 一峰的网络日志:http://www.ruanyifeng.com/blog/2011/03/url_hash.html get: 1.页面滚动到指定页面的指定位置 (eg: http://ww ...

  4. divcss5布局

    一.ie9不支持line-height字体垂直居中兼容问题    原因:CSS中使用了中文字体,而中文字体使用汉字.如:font-family:"微软雅黑"   1.将中文字体汉字 ...

  5. 【Pro ASP.NET MVC 3 Framework】.学习笔记.9.SportsStore:Securing the Administration Features

    1 设置表单身份认证 因为ASP.NET MVC基于ASP.NET平台的核心,所以我们可以使用ASP.NET Form的身份认证,这是保持用户登录轨迹通用的方法.现在介绍最基本的配置. 在Web.co ...

  6. HDU 5950:Recursive sequence(矩阵快速幂)

    http://acm.hdu.edu.cn/showproblem.php?pid=5950 题意:给出 a,b,n,递推出 f(n) = f(n-1) + f(n-2) * 2 + n ^ 4. f ...

  7. yjfk 意见反馈

    <div> <h1>我的第一个 JavaScript 程序</h1><p id="demo">这是一个段落</p>< ...

  8. Maven invalid task...

    执行maven构建项目报错: Invalid task '‐DgroupId=*': you must specify a valid lifecycle phase, or a goal in th ...

  9. 使用System.arraycopy()实现数组之间的复制

    System提供了一个静态方法arraycopy(),我们可以使用它来实现数组之间的复制. 其函数原型是: public static void arraycopy(Object src, int s ...

  10. java 基本类型之间的转换

    基本数据类型从低级到高级是:byte  short int long float double ,char 类型比int 类型之后的都要低 下面通过一个例子说明: import javax.swing ...