[英]How can I install a package using easy_install from a package on the local host?
I am trying to install Python packages using easy_install from a local directory. 我正在尝试使用easy_install从本地目录安装Python软件包。
The reason I am doing this is because of network/IT issues. 我这样做的原因是由于网络/ IT问题。
I have a workstation (Ubuntu) that can access easy_install's repositories on the Internet. 我有一个工作站(Ubuntu),可以在Internet上访问easy_install的存储库。 I can install things without any problems.
我可以毫无问题地安装东西。
We have a lab network that is closed off to the Internet. 我们有一个与Internet隔离的实验室网络。 I have an Ubuntu VM on this lab network.
我在此实验室网络上有一个Ubuntu VM。 I cannot use easy_install (or pip) to install anything because it is blocked off from the repositories.
我无法使用easy_install(或pip)来安装任何东西,因为它已从存储库中被阻止。 I need to install some Python packages so I need to work around this limitation.
我需要安装一些Python软件包,因此我需要解决此限制。
The way I got around this limitation for pip was to do a "pip download" of a package, then SCP the package file to the VM in the lab network and do a "pip install" of the package file. 我解决pip限制的方法是先对软件包进行“点下载”,然后将软件包文件SCP实验室网络中的VM,然后对软件包文件进行“点安装”。
I am trying to do this with easy_install. 我正在尝试使用easy_install进行此操作。 I was able to download the easy_install package by issuing this command
通过发出此命令,我能够下载easy_install软件包
> easy_install -q --editable --build-directory . <package name>
For example, suppose I wanted to install pip using easy_install. 例如,假设我想使用easy_install安装pip。 I have the pip directory after downloading the source code thru easy_install.
通过easy_install下载源代码后,我有了pip目录。 I can tar the pip directory and SCP it over to the VM.
我可以将pip目录打包,然后将其SCP切换到VM。 Is there a way to tell easy_install on the VM to install using the files from the pip directory rather than try to install via the external repository?
有没有办法告诉VM上的easy_install使用pip目录中的文件进行安装,而不是尝试通过外部存储库进行安装?
I have searched for a similar question to this using the easy_install tag but I don't see anything so I thought I'd ask. 我使用easy_install标记搜索了与此类似的问题,但没有看到任何内容,因此我想问一下。
devpi-server is a caching PyPI proxy. devpi-server是一个缓存的PyPI代理。 If you use it to install packages on one host, it will forward requests to https://pypi.python.org/pypi , and save everything it downloads.
如果使用它在一个主机上安装软件包,它将把请求转发到https://pypi.python.org/pypi ,并保存下载的所有内容。 Then you copy over a tarball of
~/.devpi
to another host, launch the server, and have devpi-server
serve up the cached files. 然后,您将
~/.devpi
的压缩包复制到另一个主机,启动服务器,并让devpi-server
提供缓存的文件。
Host 1 (online): 主机1(在线):
$ easy_install --user devpi-server
$ devpi-server --start
$ easy_install --user -i http://localhost:3141/root/pypi/ Django
Copy ~/.devpi
from Host 1 to Host 2 将
~/.devpi
从主机1复制到主机2
Somehow you'll also need to copy devpi-server
over to the offline box too. 您还需要以某种方式将
devpi-server
复制到离线框中。 It has quite a few dependencies. 它具有相当多的依赖性。 Maybe to bootstrap you could create a basic VM, run
easy_install --user devpi-server
, then tar up ~/.local
and copy it over? 也许要引导您可以创建一个基本的VM,运行
easy_install --user devpi-server
,然后easy_install --user devpi-server
~/.local
并将其复制过来?
Host 2 (no internet): 主机2(无互联网):
$ devpi-server --start
$ easy_install --user -i http://localhost:3141/root/pypi/ Django
# Success!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.