Anaconda allows users to have different versions of Python and R installed at the same time. These versions are managed in environments, which can be activated and deactivated according to the user's preference.
I would like to specify which version of Python or R to use when I execute a script on the command line (regardless of which environment is active). This could look like
python -version 3.7 myPy3Script.py
python -version 2.7 myPy2Script.py
Here, the first command would execute my script in Python 3, whereas the second line would execute my second script in Python 2.
Can I actually do that in practice? If so, how?
Of course, I could just specify the path to the respective python executable. However, would the libraries be loaded correctly in this case? (See this issue). Also, would there be a way to avoid typing in lengthy paths?