help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to let tramp be aware the virtualenv?


From: Bruno Barbier
Subject: Re: How to let tramp be aware the virtualenv?
Date: Tue, 16 Jul 2019 21:22:50 +0200

Hi Zhongwei,


Zhongwei Yao <address@hidden> writes:

> Hi, all,
> I try to use tramp on a remote project directory and run "M-x compile". The
> command requires to know which the python virtualenv is active.
>
> I try to let tramp be ware of which virtualenv is active by adding a line
> to the remote $HOME/.profile like (because it seems tramp will run the
> compilation command by the remote /bin/sh):
>
>   source my/python/virtualenv/bin/activate.
>
> But tramp seems doesn't read that line at all. The virtualenv is not
> activated.
>
> So how can I make tramp aware of which virtualenv is enabled?
>
> Thanks!
> Zhongwei

Are you using SSH to connect ?

If so, you might be able to configure SSH to do it.

In your ~/.ssh/config (or where your ssh config is), add something like
this:

  Host a-nice-and-very-short-name
       HostName 169.254.1.2
       RequestTTy force
       RemoteCommand sh -c 'source my/python/virtualenv/bin/activate; bash -l'


Then, using tramp, it should just work:

  /ssh:a-nice-and-very-short-name:/path/to/your-project


Bruno






reply via email to

[Prev in Thread] Current Thread [Next in Thread]