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: Zhongwei Yao
Subject: Re: How to let tramp be aware the virtualenv?
Date: Wed, 17 Jul 2019 10:02:57 +0800

Hi, Bruno,
Thanks, but it still doesn't work. (I use ssh to connect to the remote
Ubuntu server. And the /bin/sh is dash, so "source" does work. I replace it
with ".").

For example, when I run "echo $BASH_VERSION" in compilation command by
tramp, it is empty.

By using " RemoteCommand sh -c '. my/python/virtualenv/bin/activate; bash
-l'", I think all command will run in bash, right? Am I missing something?

Thanks,
Zhongwei

On Wed, Jul 17, 2019 at 2:21 AM Bruno Barbier <address@hidden> wrote:

>
> 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]