Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Basic usage/setup #75

Open
garyo opened this issue Jun 13, 2018 · 5 comments
Open

Basic usage/setup #75

garyo opened this issue Jun 13, 2018 · 5 comments

Comments

@garyo
Copy link

garyo commented Jun 13, 2018

If I have a project with a venv (local in that dir), what's the best-practices way to configure pyvenv? I assume I need a .dir-locals.el in the project root, something like this:

((python-mode . ((eval . (pyvenv-activate "venv")))))

but how to also enable pyvenv-mode and maybe pyvenv-tracking-mode? Should I set those up in a python mode hook globally in my .emacs?

It might be useful to have a more complete setup recipe in the README.

@jorgenschaefer
Copy link
Owner

The best practice for using pyvenv is to stick to the best practice set up with virtualenvwrapper, i.e. do not put your virtualenvs into the same directory as your project but keep them in a ~/.virtualenvs/ directory. If you use virtualenvwrapper in your shell, pyvenv should work by default exactly like in the shell using M-x pyvenv-workon instead of workon.

@sid-kap
Copy link

sid-kap commented Jul 5, 2018

@jorgenschaefer Can you elaborate? My virtualenv happens to be in the directory, not in ~/.virtualenvs/.
How can I tell pyvenv where my virtualenv is?

@jorgenschaefer
Copy link
Owner

If you do not use the normal virtualenvwrapper setup, you can use M-x pyvenv-activate like you'd use the activate script of a virtualenv.

@sid-kap
Copy link

sid-kap commented Jul 8, 2018

I mean, if I want it to remember which venv to use for my directly? Since that's what this thread is about

@jorgenschaefer
Copy link
Owner

You can use pyvenv-tracking-mode and set pyvenv-workon or pavenv-activate in the respective buffer? I usually don't, because switching virtualenvs takes time, so I juse use pyvenv-workon manually.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants