在没有互联网的情况下安装python软件包,并将源代码用作.tar.gz和.whl [英] installing python packages without internet and using source code as .tar.gz and .whl

查看:268
本文介绍了在没有互联网的情况下安装python软件包,并将源代码用作.tar.gz和.whl的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们正在尝试在没有互联网的情况下安装几个python软件包.

we are trying to install couple of python packages without internet.

For ex : python-keystoneclient

为此,我们从 https://pypi.python下载了软件包. org/pypi/python-keystoneclient/1.7.1 并将其保存在服务器中.

For that we have the packages downloaded from https://pypi.python.org/pypi/python-keystoneclient/1.7.1 and kept it in server.

但是,在安装tar.gz和.whl软件包时,安装程​​序正在寻找要首先安装的相关软件包.由于服务器中没有Internet连接,因此连接失败.

However, while installing tar.gz and .whl packages , the installation is looking for dependent packages to be installed first. Since there is no internet connection in the server, it is getting failed.

例如:对于python-keystoneclient,我们具有以下依赖包

For ex : For python-keystoneclient we have the following dependent packages

stevedore (>=1.5.0)
six (>=1.9.0)
requests (>=2.5.2)
PrettyTable (<0.8,>=0.7)
oslo.utils (>=2.0.0)
oslo.serialization (>=1.4.0)
oslo.i18n (>=1.5.0)
oslo.config (>=2.3.0)
netaddr (!=0.7.16,>=0.7.12)
debtcollector (>=0.3.0)
iso8601 (>=0.1.9)
Babel (>=1.3)
argparse
pbr (<2.0,>=1.6)

当我尝试从上面的列表中一个接一个地安装软件包时,再次寻找嵌套依赖.

When i try to install packages one by one from the above list, once again its looking for nested dependency .

有什么办法可以列出 ALL 依赖包来安装python-keystoneclient之类的python模块.

Is there any way we could list ALL the dependent packages for installing a python module like python-keystoneclient.

推荐答案

这是我处理这种情况的方式:

This is how I handle this case:

在我可以访问Internet的计算机上:

On the machine where I have access to Internet:

mkdir keystone-deps
pip download python-keystoneclient -d "/home/aviuser/keystone-deps"
tar cvfz keystone-deps.tgz keystone-deps

然后将tar文件移动到无法访问Internet的目标计算机,并执行以下操作:

Then move the tar file to the destination machine that does not have Internet access and perform the following:

tar xvfz keystone-deps.tgz
cd keystone-deps
pip install python_keystoneclient-2.3.1-py2.py3-none-any.whl -f ./ --no-index

您可能需要在命令中添加--no-deps,如下所示:

You may need to add --no-deps to the command as follows:

pip install python_keystoneclient-2.3.1-py2.py3-none-any.whl -f ./ --no-index --no-deps

这篇关于在没有互联网的情况下安装python软件包,并将源代码用作.tar.gz和.whl的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆