简体   繁体   中英

Is it possible to create a fully self-contained Python package?

The question

Ansible is a python moduel, installable via pip. It relies on several dependencies, also pip modules. Is it possible to "roll up" all of those dependencies and Ansible itself into some sort of a single package, that can be installed offline, without root? It's highly preferable to not need pip for the install, although it will be available for package creation.

Extra background

I'm trying to install Ansible on one of our servers. The server does not have access to the internet, there is no root access. Pip is not installed, but Python is. It is possible to get pip installed there, but might be complicated. The only way to get anything on the server is via an internal tar.gz package sharing solution.

I've tried fiddling around with rpm, saving dependencies, but the absence of root access put an end to that.

Use pip on an internet-connected machine to download all the deps to a local dir with --download and -r requirements.txt , then drop that dir on the disconnected machine with pip installed, and install using --no-index and --find-links=(archive dir) .

See https://pip.pypa.io/en/latest/user_guide/#fast-local-installs

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM