pipenv
has a design centered around projects having their own venvs. What if I have a generic venv that I want to use for scripting or to be shared with other projects and therefore I would like it to be activate while the current directory is pointing anywhere in the system. How can I achieve this? I looked up the docs and I couldn't see a way to do it.
In conda, one can simply activate an environment by specifying its name, no matter whats the current directory is. Even virtualenv
can do the same but you have to specify the path.
At the directory where Pipfile resides, find the path to the environment:
pipenv --venv
Copy that path, for example /Users/yourname/.local/share/virtualenvs/yourproject-7qj8f3ed. Then in any other folder you can activate the venv with source
, e.g.:
source /Users/yourname/.local/share/virtualenvs/yourproject-7qj8f3ed/bin/activate
You could also put an alias in bash.rc, etc to make a shortcut to that command.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With