gpt4 book ai didi

python - 在没有互联网访问权限的 rhel 6 上的虚拟 python 环境(virtualenv 或 pyvenv)中安装 rpm 包

转载 作者:行者123 更新时间:2023-12-05 07:55:34 24 4
gpt4 key购买 nike

我的 RHEL 服务器只能访问我的 IT 部门预先批准的软件包。我正在开发将托管在此服务器上的 Python 应用程序。现在,我已经设法在不同的位置 (/usr/local/bin) 构建了最新版本的 python。我能够创建虚拟环境以将其与系统的其余部分隔离开来。

现在,我需要在环境中使用 pip 安装包以使应用程序运行,例如。 Django 。由于 IT 已禁用对 Internet 的所有访问,因此我无法执行 pip install package_name。好吧,我可以,但它会尝试从 Internet 下载程序包并超时。下载django包的rpm,尝试在虚拟环境下安装,失败:

(envtest) [root@arlwebimgakp02 envtest]# rpm -ivh python3-django-1.7.2-1.fc22.noarch.rpm
error: Failed dependencies:
/usr/bin/python3 is needed by python3-django-1.7.2-1.fc22.noarch
python(abi) = 3.4 is needed by python3-django-1.7.2-1.fc22.noarch
python-django-bash-completion = 1.7.2-1.fc22 is needed by python3-django-1.7.2-1.fc22.noarch
python3 is needed by python3-django-1.7.2-1.fc22.noarch

所以看起来 rpm 安装正在从通用安装的 python (2.6.6) 中寻找依赖项,而不是在虚拟环境中使用的单独编译的 3.4.3。我什至可以这样做吗?我可以将 rpm 包安装到虚拟环境吗?在没有互联网访问服务器的情况下,我还能如何让我的 python 包安装在我的虚拟环境中?

最佳答案

RPM 是系统级的包管理器。它将检查其内部数据库的依赖关系。不检查可执行文件 python 是否存在,但包 python 是否存在。

你需要下载Django-1.8.tar.gz,复制到linux机器上

pip install Django-1.8.tar.gz

关于python - 在没有互联网访问权限的 rhel 6 上的虚拟 python 环境(virtualenv 或 pyvenv)中安装 rpm 包,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29681618/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com