pyvenv icon indicating copy to clipboard operation
pyvenv copied to clipboard

auto-activation of virtual env?

Open biocyberman opened this issue 7 years ago • 3 comments

I usually have a env or venv directory which is created by python3 -m venv env. How do I get this virtual environment activated automatically when I open any python script under myapp and its subdirectories. Even more useful I have option set deactivate automatically virtual environment env if I navigate and open python scripts outside of myapp:

 myapp
├── src
│   ├── app.py
├── templates
│   ├── index.html
│   └── login.html
└── env
    ├── bin
    ├── include
    ├── lib
    ├── pip-selfcheck.json
    └── pyvenv.cfg

biocyberman avatar Oct 11 '18 18:10 biocyberman

This is not supported by default in Elpy.

You can use .dir-locals.el to specify the virtualenv for pyvenv-tracking-mode. Alternatively, you can look at the definition of pyvenv-tracking-mode to get some inspiration on how to do this in your init.el without adding new files to your project (or .gitignore).

Does this help?

jorgenschaefer avatar Oct 12 '18 07:10 jorgenschaefer

Thanks I will check that out.

biocyberman avatar Oct 24 '18 13:10 biocyberman

You can always try this https://github.com/jorgenschaefer/pyvenv/issues/51#issuecomment-474785730

captain-kark avatar Mar 20 '19 11:03 captain-kark