离线安装python依赖
2018-01-05 15:43
666 查看
部署环境的时候,遇上封闭环境。总会有安装依赖的需求,这个时候必须得有个python第三方包的list,一般放在requirements.txt。
进入虚拟环境envX
但是实际使用发现这个工具生成的依赖并不完整,如果后面碰到更好的工具再更新。
p.s. 在线安装
如果有网络,也有requirements.txt,执行
1.生成requirements.txt的方法
情形1
如果一个项目使用时virtualenv环境,pip freeze 就可以解决进入虚拟环境envX
pip freeze > requirements.txt将包依赖信息保存在requirements.txt文件中。
情形2
但是如果一个项目的依赖list没有维护,而且又是环境混用,那就不好整理了,据说pipreqs这个工具可以自动根据源码生成 requirements.txt。实用的方法很简单:pip install pipreqs # 使用方式也比较简单 pipreqs ./
但是实际使用发现这个工具生成的依赖并不完整,如果后面碰到更好的工具再更新。
2.离线安装
离线时候光有reqirements.txt肯定是不行了。必须提前准备好安装包,一个个的去下载显然费时费力,还容易出错。#新建一个文件夹packages #打包已安装的包 pip install --download d:\python27\packages -r requirements.txt #离线安装 pip install --no-index --find-links=d:\python27\packages -r requirements.txt
p.s. 在线安装
如果有网络,也有requirements.txt,执行
pip install -r requirements.txt,pip就会自动从网上下载并安装所有包。
相关文章推荐
- 使用Pip在离线环境安装Python依赖库
- Python虚拟环境在离线断网环境下创建项目虚拟环境和安装依赖包
- 离线安装python依赖库
- Linux离线编译安装Python环境
- 2、linux上离线安装python
- 2、linux上离线安装python
- python setuptools离线安装方法
- Python与Anaconda离线安装TensorFlow For Windows
- python离线安装包
- python pip 离线 安装
- windows eclipse python 离线安装PyDev插件教程
- python Flask离线安装与测试
- caffe安装系列——安装python依赖包
- Windows10离线安装tensorflow_gpu-1.5.0rc1-cp36-cp36m-win_amd64.whl(对应GPU版本的tensorflow,对应python3.6)
- 非root用户离线安装python的第三方库
- python3.5 安装matplotlib与依赖库安装教程
- Python安装lxml(编译安装其依赖的库)
- 在Windows中安装Python中matplotlib,缺少的依赖包
- 【linux】安装python依赖库confluent_kafka
- 2、linux上离线安装python