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

查看:24
本文介绍了在没有互联网的情况下安装 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 包时,安装会首先寻找依赖包.由于服务器中没有互联网连接,所以它正在失败.

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 .

有什么方法可以列出所有用于安装python模块(如python-keystoneclient.js)的依赖包.

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:

在我可以访问互联网的机器上:

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天全站免登陆