run single command in specific python version with pyenv
Asked Answered
C

1

12

I'm using notebooks mostly, so on the commandline I often only want to install a specific package for a specific python version I have. Currently, I usually change the global python version, run pip and change the global version back. Is there a way to execute a single command in a specific pyenv version?

Camala answered 17/10, 2018 at 9:10 Comment(0)
F
12

You can override which version/environment is being used via the PYENV_VERSION environment variable

# PYENV_VERSION=2.7.15 pip install package
# PYENV_VERSION=3.6.6/some_virtualenv ipython
Fanchan answered 17/1, 2019 at 18:9 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.