如何在没有Internet的情况下与远程主机共享整个python env? [英] How to share a total python env with a remote host without Internet?
问题描述
我有一个远程Linux主机(我不是超级用户),只能通过ssh shell与本地主机通信。
I have a remote Linux host(I'm not superuser) which can only communicate with my local host via ssh shell.
- 我的远程主机没有Internet,但是安装了python3.6.5,conda4.5.4。
- 我的本地主机具有Internet,可以通过Internet安装软件包和python。
我需要在远程主机上运行python2.7代码,但是缺少python2.7虚拟环境和相关的依赖程序包。
I need to run my python2.7 code on a remote host, but the python2.7 virtual environment and the related dependent packages are lacked.
我想配置py2.7环境(my_py2env)并在本地主机上安装所有必需的依赖项。 并将所有需要的文件打包到一个包中,例如tar.gz包。将其发送到我的远程主机并解压缩。如果我可以使用一些conda命令,例如 conda --clone
,这会将我的所有环境(my_py2env)部署在远程主机。那将是完美的。那可能吗?我怎么知道呢?
I want to configure a py2.7 environment(my_py2env) and install all the needed dependencies on my localhost. And package all the needed file into a pack, such as tar.gz package. Send it to my remote host and unpack it. If I can use some conda commands such as conda --clone
and this deploys all my environment(my_py2env) on the remote host. That will be perfect. Is that possible? How can I realize it?
非常感谢!
推荐答案
我认为您可以使用带有-R选项的ssh命令将本地端口映射到远程主机,并且可以在本地计算机上设置http代理并在映射的端口上进行侦听。
I think there may be you can use ssh command with options -R to map a local port to the remote host, and you can setup a http proxy on your local machine and listen on the mapped port.
现在,您可以通过映射的http代理在virtualenv中安装所需的软件包。
Now you can install required package in a virtualenv via the http proxy you mapped.
这篇关于如何在没有Internet的情况下与远程主机共享整个python env?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!