Pipenv activate command - activate the virtual environment in the current shell
See original GitHub issueBe sure to check the existing issues (both open and closed!), and make sure you are running the latest version of Pipenv.
Check the diagnose documentation for common issues and the PEEP list before posting! We may close your issue if it is very similar to one of them. Please be considerate and follow the PEEP process, or be on your way.
Make sure to mention your debugging experience if the documented solution failed.
Is your feature request related to a problem? Please describe.
I’d like to be able to use a pipenv command to activate the virtual environment for a project in the current shell. pipenv shell
spawns a new shell (and often doesn’t work in a containerized environment) and the alternative is to use shell commands, which is fine but less straightforward.
Describe the solution you’d like
A new command pipenv activate
that does the equivalent of calling source activate
for the virtual environment. Then a user can call the exsting virtualenv deactivate
when they want to deactivate the environment.
Describe alternatives you’ve considered
My current workaround on bash is source $(dirname $(pipenv run which python))/activate
. It’s fine but not intuitive for someone not experienced with bash. It also breaks due to things like #5003 modifying stdout.
Additional context
Add any other context or screenshots about the feature request here. It may be a good idea to mention that platform and Python version you are on.
Please run $ pipenv --support
, and paste the results here. Don’t put backticks (`
) around it! The output already contains Markdown formatting.
(removed because too long for max issue body)
Issue Analytics
- State:
- Created a year ago
- Reactions:1
- Comments:7 (2 by maintainers)
Top GitHub Comments
It is very easy to create an alias or shell function that does the following:
we are not going to implement it in pipenv.
Yeah, fine by me. For posterity, that command doesn’t work in windows since virtual environment exes are placed in the “Scripts” folder. That’s why I’ve been using
source $(dirname $(pipenv run which python))/activate
, so I can copy/paste the same thing wherever I am.