Use pyenv activate inside a script
#3277
-
|
Hello, I would like to automate the creation of my virtualenvs, and in one command run the pyenv command to build it, activate it, and then run something like pip install -r requirements.txt all one command. Is there a hook to make this happen now, and if not, can we add one? |
Beta Was this translation helpful? Give feedback.
Answered by
native-api
Jun 17, 2025
Replies: 1 comment
-
|
To run Pyenv in-shell subcommands from a script, install #!/bin/bash
eval "$(pyenv init - bash)"
# now we can use Pyenv in-shell subcommands
pyenv virtualenv test
pyenv activate test
pip install numpy |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
native-api
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
To run Pyenv in-shell subcommands from a script, install
pyenvas a shell function inside the script first: