How to set default version for an external language code cell?
This may be realised by manipulating the registered external bundles.
Based on the OP's scenario, one can simply do the following:
RegisterExternalEvaluator["Python", "path/to/python3.8.2"]
Then Python3.8.2
would appear at the top of the external evaluators:
FindExternalEvaluators["Python"][All, "Version"]
Once the kernel is restarted, the notebook external language cell will default to the 3.8.2 kernel:
import sys;(sys.executable, sys.version)
A public ResourceFunction
called SetLanguageCellSession gives a complete solution for managing external language sessions in Python, Julia, R, etc.
Basic example:
This solution works in 12.1 and 12.2 and so answers these posts as well:
- "ExternalLanguage" cell with ExternalSessionObject
- Use conda env for ExternalLanguage cell?