码迷,mamicode.com
首页 > 其他好文 > 详细

离线下载pip包安装

时间:2018-02-07 21:29:56      阅读:166      评论:0      收藏:0      [点我收藏+]

标签:/tmp   require   off   number   nbsp   string   str   sftp   内网   

Host-A 不能上网,但是需要在上面安装python-package

通过另外一台能上网的Host-B主机

1. 下载需要离线安装的Packages

在Host-B上执行如下命令:

安装单个Package

$ pip install <package> --download /tmp/offline_packages

安装多个Packages

$ pip install --download /tmp/offline_packages -r requirements.txt

 2. 将下载好的Packages拷贝至内网服务器

使用scp、sftp等方式将下载好的Packages拷贝至需要离线安装这些包的内网服务器。

3. 安装Packages

假设内网服务器的目录 /tmp/transferred_packages 包含你上一步远程拷贝过来packages,在内网服务器上执行如下命令

安装单个Package的情况

$ pip install --no-index --find-links="/tmp/tranferred_packages" <package>

安装多个Packages

$ pip install --no-index --find-links="/tmp/tranferred_packages" -r requirements.txt

离线下载pip包安装

标签:/tmp   require   off   number   nbsp   string   str   sftp   内网   

原文地址:https://www.cnblogs.com/liqing1009/p/8428305.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!