How to share a total python env with a remote host

2019-07-23 04:21发布

问题:

I have a remote Linux host(I'm not superuser) which can only communicate with my local host via ssh shell.

  • my remote host has NO Internet, but has python3.6.5, conda4.5.4 installed.
  • my local host has Internet and can install packages and python through the Internet.

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.

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?

Thank you very much!

回答1:

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.

Now you can install required package in a virtualenv via the http proxy you mapped.



标签: python ssh conda