GaryO
GaryO

Reputation: 6338

Is it possible to use pipenv in same shell (not subshell)?

I'm new to pipenv. I'm used to virtualenv, where I can source a script to "activate" the env in my current shell. Is there a way to use pipenv that way, rather than starting a subshell? I.e. source $(pipenv shell-env) or something like that? I'd like to have a linear shell history, not have to double-exit to exit the terminal window, etc. I'm using python 3.6 and 3.7 on Mac and Windows primarily.

Upvotes: 4

Views: 1008

Answers (1)

codingjoe
codingjoe

Reputation: 1257

On Linux or macOS:

source "$(pipenv --venv)/bin/activate"

On Windows (using bash; thanks @Nickolay):

source "$(pipenv --venv)/Scripts/activate"

Upvotes: 5

Related Questions