fbence
fbence

Reputation: 2153

run single command in specific python version with pyenv

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?

Upvotes: 13

Views: 3017

Answers (1)

nicotine
nicotine

Reputation: 290

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

Upvotes: 13

Related Questions