您现在的位置是: 首页 > 后端开发 > Python Python自动生成和安装requirements.txt文件中的依赖
Python自动生成和安装requirements.txt文件中的依赖
2020-05-20 【Python】 2590人已围观 5467次浏览
简介Python自动生成和安装requirements.txt文件中的依赖
经常看见别人的Python项目中,出现一个名叫requirements.txt的文件,里面记录了当前程序所有用到的依赖包和精确的版本号,类似PHP中的composer.json文件,主要是方便在一台新的机器上重新构建项目所需要的依赖,否则自己一个个去找这些依赖来安装,是想当痛苦的,依赖包和对应的版本,都是容易出错的地方
所以在自己的项目中,最好是生成一个这样的文件,便于在其他电脑上重新构建
可以通过pip命令进行生成,在当前项目的根目录下执行下面的命令
pip freeze > requirements.txt
如果是Python2 和 Python3 共存的电脑,需要自行修改pip版本,比如pip3
在新的电脑上,执行下面的命令,即可通过requirements.txt文件中的信息,构建项目所需要的依赖包
pip install -r requirements.txt
很赞哦! (0)
下一篇:CentOS 安装Python3
点击排行
- Error in execution; nested exception is io.lettuce.core.RedisCommandExecutionException: ERR DISABLE You can't write or read against a disable instance
- Debian apt 使用国内镜像
- RocketMQ 出现 sendDefaultImpl call timeout 问题
- 类 BASE64Decoder 程序包 sun.misc 找不到符号
- SpringBoot @NotBlank 不生效问题
- 记一次 Mybatis-Plus 自动填充无效问题解决
- SpringBoot 2.x 文件上传出现 The field file exceeds its maximum permitted size of 1048576 bytes
- nuxt 项目完整部署方案
站长推荐
猜你喜欢
- Redis 提示 MISCONF Redis is configured to save RDB snapshots, but it is currently not able to persist on disk 解决方案
- LNMP定时备份任务教程(支持排除指定文件夹)
- mysql 索引过长1071-max key length is 767 byte
- gulp3 在 node12 上运行出现异常 primordials is not defined
- SqlServer 查询包含指定字段的存储过程
- 记一次Java MessageFormat.format踩坑
- Vue 报错 Avoid using non-primitive value as key, use string/number value instead
- RocketMQ 出现 sendDefaultImpl call timeout 问题
- idea去掉Smart commands execution提示
- cmder vim方向键无法使用 解决方案