Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How does bazel choose the python version?

Tags:

I'm running a python binary target with bazel run xxx and in the target I'm doing print(sys.version). This outputs Python version 3.6.8 (default, Jan 14 2019, 11:02:34)

When I type the python command directly, I get Python 3.7.3 (default, Apr 3 2019, 19:16:38)

Why/how did bazel choose a different python version?

like image 359
Mark Avatar asked Nov 15 '19 00:11

Mark


1 Answers

Bazel will choose different python versions based on the configuration of the build. If nothing is overriden, bazel will use its default python version. This can be overridden by passing --python_version=<some_version> when running a bazel command.

https://docs.bazel.build/versions/master/be/python.html#py_binary.python_version https://github.com/bazelbuild/rules_python/blob/120590e2f2b66e5590bf4dc8ebef9c5338984775/python/BUILD#L43

like image 165
Dave Hughes Avatar answered Jan 02 '23 10:01

Dave Hughes