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?
As a standard, it is recommended to use the python3 command or python3. 7 to select a specific version. The py.exe launcher will automatically select the most recent version of Python you've installed. You can also use commands like py -3.7 to select a particular version, or py --list to see which versions can be used.
Shims are lightweight executables that simply pass your command along to pyenv. So with pyenv installed, when you run, say, pip , your operating system will do the following: Search your PATH for an executable file named pip. Find the pyenv shim named pip at the beginning of your PATH.
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With