//python/bin
- //python/bin:python
A target to directly run a Python interpreter.
By default, it uses the Python version that toolchain resolution matches(typically the one set with
python.defaults(python_version=...)inMODULE.bazel).This runs a Python interpreter in a similar manner as when running
python3on the command line. It can be invoked usingbazelrun. Remember that inorder to pass flags onto the program--must be specified to separateBazel flags from the program flags.An example that will run Python 3.12 and have it print the version
bazel run @rules_python//python/bin:python \ `--@rule_python//python/config_settings:python_verion=3.12 \ -- \ --version
See also
The
--python_srcflag for using the intepreter a binary/test uses.
Added in version 1.3.0.
- flag--//python/bin:python_src
The target (one providing
PyRuntimeInfo) whose python interpreter to use for:python.